diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c9426a7..656a2b7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ ### 🐞 Fixes +- [#334](https://github.com/estruyf/vscode-front-matter/issues/334): Fix for locked content folders retrieval + + ## [7.2.0] - 2022-05-02 - [Release notes](https://beta.frontmatter.codes/updates/v7.2.0) ### 🎨 Enhancements diff --git a/src/commands/Folders.ts b/src/commands/Folders.ts index 58b629e7..ea64490c 100644 --- a/src/commands/Folders.ts +++ b/src/commands/Folders.ts @@ -6,7 +6,7 @@ import { ContentFolder, FileInfo, FolderInfo } from "../models"; import uniqBy = require("lodash.uniqby"); import { Template } from "./Template"; import { Notifications } from "../helpers/Notifications"; -import { Settings } from "../helpers"; +import { Logger, Settings } from "../helpers"; import { existsSync, mkdirSync } from 'fs'; import { format } from 'date-fns'; import { Dashboard } from './Dashboard'; @@ -362,7 +362,11 @@ export class Folders { let folders: string[] = []; for (const pattern of patterns) { - folders = [...folders, ...(await this.findFolders(pattern))]; + try { + folders = [...folders, ...(await this.findFolders(pattern))]; + } catch (e) { + Logger.error(`Something went wrong while searching for folders with pattern "${pattern}": ${(e as Error).message}`); + } } // Filter out the workspace folder diff --git a/src/helpers/DashboardSettings.ts b/src/helpers/DashboardSettings.ts index 5821b883..65d36f93 100644 --- a/src/helpers/DashboardSettings.ts +++ b/src/helpers/DashboardSettings.ts @@ -19,8 +19,6 @@ export class DashboardSettings { const ext = Extension.getInstance(); const wsFolder = Folders.getWorkspaceFolder(); const isInitialized = await Template.isInitialized(); - - const contentFolders = await Folders.getContentFolders(); return { beta: ext.isBetaVersion(), @@ -56,7 +54,7 @@ export class DashboardSettings { mimeTypes: Settings.get(SETTING_MEDIA_SUPPORTED_MIMETYPES) }, welcome: { - contentFolders + contentFolders: !isInitialized ? await Folders.getContentFolders() : [] } }, dataFiles: await this.getDataFiles(),