diff --git a/CHANGELOG.md b/CHANGELOG.md index 92e0f944..3f1880af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ ### 🐞 Fixes +- [#469](https://github.com/estruyf/vscode-front-matter/issues/469): Fix for using the root folder as content folder - [#470](https://github.com/estruyf/vscode-front-matter/issues/470): Fix `initialize project` dashboard description - [#482](https://github.com/estruyf/vscode-front-matter/issues/482): Update the description when you want to overwrite the default content type description diff --git a/src/commands/Folders.ts b/src/commands/Folders.ts index ed280a5f..7ea268d2 100644 --- a/src/commands/Folders.ts +++ b/src/commands/Folders.ts @@ -253,14 +253,19 @@ export class Folders { try { let projectStart = parseWinPath(folder.path).replace(wsFolder, ""); - if (projectStart) { + if (typeof projectStart === 'string') { projectStart = projectStart.replace(/\\/g, '/'); projectStart = projectStart.startsWith('/') ? projectStart.substring(1) : projectStart; let files: Uri[] = []; for (const fileType of (supportedFiles || DEFAULT_FILE_TYPES)) { - const filePath = join(projectStart, folder.excludeSubdir ? '/' : '**', `*${fileType.startsWith('.') ? '' : '.'}${fileType}`); + let filePath = join(projectStart, folder.excludeSubdir ? '/' : '**', `*${fileType.startsWith('.') ? '' : '.'}${fileType}`); + + if (projectStart === '' && folder.excludeSubdir) { + filePath = `*${fileType.startsWith('.') ? '' : '.'}${fileType}`; + } + const foundFiles = await workspace.findFiles(filePath, '**/node_modules/**'); files = [...files, ...foundFiles]; }