diff --git a/Frameworks/Find/src/Find.mm b/Frameworks/Find/src/Find.mm index 973db13b..a10bdf58 100644 --- a/Frameworks/Find/src/Find.mm +++ b/Frameworks/Find/src/Find.mm @@ -233,18 +233,6 @@ NSString* const FolderOptionsDefaultsKey = @"Folder Search Options"; { case FindActionFindAll: { - NSString* glob = controller.globString; - if([glob isEqualToString:@"*"]) - glob = @"{.,}*"; - - std::string excludeGlob = ""; - if(![controller.searchIn isEqualToString:FFSearchInOpenFiles]) - { - static std::string const excludeKeys[] = { kSettingsExcludeInFolderSearchKey, kSettingsExcludeKey }; - for(size_t i = 0; i < sizeofA(excludeKeys) && excludeGlob == ""; ++i) - excludeGlob = settings_for_path(NULL_STR, "", to_s(controller.searchFolder)).get(excludeKeys[i], ""); - } - FFDocumentSearch* folderSearch = [[FFDocumentSearch new] autorelease]; folderSearch.searchString = controller.findString; folderSearch.options = findOptions; @@ -255,7 +243,19 @@ NSString* const FolderOptionsDefaultsKey = @"Folder Search Options"; } else { - find::folder_scan_settings_t search([controller.searchIn isEqualToString:FFSearchInOpenFiles] ? find::folder_scan_settings_t::open_files : to_s(controller.searchFolder), [glob UTF8String], excludeGlob, controller.followLinks, !controller.searchHiddenFolders); + path::glob_list_t globs; + if(![controller.searchIn isEqualToString:FFSearchInOpenFiles]) + { + auto const settings = settings_for_path(NULL_STR, "", to_s(controller.searchFolder)); + globs.add_exclude_glob(settings.get(kSettingsExcludeDirectoriesInFolderSearchKey, NULL_STR), path::kPathItemDirectory); + globs.add_exclude_glob(settings.get(kSettingsExcludeFilesInFolderSearchKey, NULL_STR), path::kPathItemFile); + for(auto key : { kSettingsExcludeInFolderSearchKey, kSettingsExcludeKey, kSettingsBinaryKey }) + globs.add_exclude_glob(settings.get(key, NULL_STR)); + globs.add_include_glob(controller.searchHiddenFolders ? "{,.}*" : "*", path::kPathItemDirectory); + globs.add_include_glob(to_s(controller.globString), path::kPathItemFile); + } + + find::folder_scan_settings_t search([controller.searchIn isEqualToString:FFSearchInOpenFiles] ? find::folder_scan_settings_t::open_files : to_s(controller.searchFolder), globs, controller.followLinks); [folderSearch setFolderOptions:search]; folderSettings[controller.searchFolder.UTF8String] = search; } diff --git a/Frameworks/OakFilterList/src/datasources/OakFileChooser.mm b/Frameworks/OakFilterList/src/datasources/OakFileChooser.mm index eba381af..cd9f4874 100644 --- a/Frameworks/OakFilterList/src/datasources/OakFileChooser.mm +++ b/Frameworks/OakFilterList/src/datasources/OakFileChooser.mm @@ -176,12 +176,16 @@ void file_chooser_t::set_path (std::string const& path) _filtered_documents.clear(); _ranked_items.clear(); - std::string excludeGlob = ""; - static std::string const excludeKeys[] = { kSettingsExcludeInFileChooserKey, kSettingsExcludeKey }; - for(size_t i = 0; i < sizeofA(excludeKeys) && excludeGlob == ""; ++i) - excludeGlob = settings_for_path(NULL_STR, "", path).get(excludeKeys[i], ""); + auto const settings = settings_for_path(NULL_STR, "", path); + path::glob_list_t globs; + globs.add_exclude_glob(settings.get(kSettingsExcludeDirectoriesInFileChooserKey, NULL_STR), path::kPathItemDirectory); + globs.add_exclude_glob(settings.get(kSettingsExcludeFilesInFileChooserKey, NULL_STR), path::kPathItemFile); + for(auto key : { kSettingsExcludeInFileChooserKey, kSettingsExcludeKey, kSettingsBinaryKey }) + globs.add_exclude_glob(settings.get(key, NULL_STR)); + globs.add_include_glob("*", path::kPathItemDirectory); + globs.add_include_glob("{,.}*", path::kPathItemFile); - _scanner.reset(new document::scanner_t(_path, "{,.}*", excludeGlob)); + _scanner.reset(new document::scanner_t(_path, globs)); } void file_chooser_t::add_documents (std::vector const& documents)