From 6b41264f53f4db0d5f5c52c7094056f6b6c38676 Mon Sep 17 00:00:00 2001 From: Oliver Schwendener Date: Mon, 5 Nov 2018 17:53:32 +0100 Subject: [PATCH] Include subfolders in file search plugin --- .../integration/search-plugins/file-search-plugin.test.ts | 4 +++- src/ts/search-plugins/file-search-plugin.ts | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/tests/integration/search-plugins/file-search-plugin.test.ts b/src/tests/integration/search-plugins/file-search-plugin.test.ts index d886f972c..8201b4e33 100644 --- a/src/tests/integration/search-plugins/file-search-plugin.test.ts +++ b/src/tests/integration/search-plugins/file-search-plugin.test.ts @@ -93,7 +93,9 @@ describe(FileSearchPlugin.name, (): void => { const plugin = new FileSearchPlugin(options, testIconSet, emptyBlackList); const actual = plugin.getAllItems(); const actualLength = actual.length; - const expectedLength = (parentFolders.length * subFolders.length * testFiles.length) + (parentFolders.length * testFiles.length); + const expectedLength = (parentFolders.length * subFolders.length * testFiles.length) + + (parentFolders.length * testFiles.length) + + (parentFolders.length * subFolders.length); expect(actualLength).toBe(expectedLength); }); diff --git a/src/ts/search-plugins/file-search-plugin.ts b/src/ts/search-plugins/file-search-plugin.ts index 7ab071a48..3f3302192 100644 --- a/src/ts/search-plugins/file-search-plugin.ts +++ b/src/ts/search-plugins/file-search-plugin.ts @@ -30,11 +30,12 @@ export class FileSearchPlugin implements SearchPlugin { private loadFilesAndFolders(): SearchResultItem[] { const result = [] as SearchResultItem[]; + const includeFolders = true; if (this.fileSearchOptions.length > 0) { for (const option of this.fileSearchOptions) { const filePaths = option.recursive - ? FileHelpers.getFilesFromFolderRecursively(option.folderPath, this.blackList) + ? FileHelpers.getFilesFromFolderRecursively(option.folderPath, this.blackList, includeFolders) : FileHelpers.getFilesFromFolder(option.folderPath); for (const filePath of filePaths) {