diff options
| author | Alexander Karatarakis <alkarata@microsoft.com> | 2017-04-12 23:15:02 -0700 |
|---|---|---|
| committer | Alexander Karatarakis <alkarata@microsoft.com> | 2017-04-12 23:15:02 -0700 |
| commit | bd01f8ce83a0f4fc1963471623971d55d7460972 (patch) | |
| tree | 81f1678e10dc474efae6dc1bec1777d77d0f2867 /toolsrc/src | |
| parent | 1b21fd0f71e5dd428c5f80396aa50ec7e0a9ee00 (diff) | |
| download | vcpkg-bd01f8ce83a0f4fc1963471623971d55d7460972.tar.gz vcpkg-bd01f8ce83a0f4fc1963471623971d55d7460972.zip | |
get_files_recursive()/get_files_non_recursive()
Diffstat (limited to 'toolsrc/src')
| -rw-r--r-- | toolsrc/src/Paragraphs.cpp | 2 | ||||
| -rw-r--r-- | toolsrc/src/PostBuildLint.cpp | 27 | ||||
| -rw-r--r-- | toolsrc/src/VcpkgPaths.cpp | 4 | ||||
| -rw-r--r-- | toolsrc/src/commands_cache.cpp | 2 | ||||
| -rw-r--r-- | toolsrc/src/commands_help.cpp | 2 | ||||
| -rw-r--r-- | toolsrc/src/commands_import.cpp | 2 | ||||
| -rw-r--r-- | toolsrc/src/commands_install.cpp | 4 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg_Files.cpp | 4 | ||||
| -rw-r--r-- | toolsrc/src/vcpkglib.cpp | 2 |
9 files changed, 24 insertions, 25 deletions
diff --git a/toolsrc/src/Paragraphs.cpp b/toolsrc/src/Paragraphs.cpp index 9494656ed..f14552169 100644 --- a/toolsrc/src/Paragraphs.cpp +++ b/toolsrc/src/Paragraphs.cpp @@ -237,7 +237,7 @@ namespace vcpkg::Paragraphs std::vector<SourceParagraph> load_all_ports(const Files::Filesystem& fs, const fs::path& ports_dir) { std::vector<SourceParagraph> output; - for (auto&& path : fs.non_recursive_find_all_files_in_dir(ports_dir)) + for (auto&& path : fs.get_files_non_recursive(ports_dir)) { Expected<SourceParagraph> source_paragraph = try_load_port(fs, path); if (auto srcpgh = source_paragraph.get()) diff --git a/toolsrc/src/PostBuildLint.cpp b/toolsrc/src/PostBuildLint.cpp index c703e1fcb..e165cf112 100644 --- a/toolsrc/src/PostBuildLint.cpp +++ b/toolsrc/src/PostBuildLint.cpp @@ -94,7 +94,7 @@ namespace vcpkg::PostBuildLint { const fs::path debug_include_dir = package_dir / "debug" / "include"; - std::vector<fs::path> files_found = fs.recursive_find_all_files_in_dir(debug_include_dir); + std::vector<fs::path> files_found = fs.get_files_recursive(debug_include_dir); Util::unstable_keep_if(files_found, [&fs](const fs::path& path) { @@ -151,7 +151,7 @@ namespace vcpkg::PostBuildLint std::vector<fs::path> misplaced_cmake_files; for (auto&& dir : dirs) { - auto files = fs.recursive_find_all_files_in_dir(dir); + auto files = fs.get_files_recursive(dir); for (auto&& file : files) { if (!fs.is_directory(file) && file.extension() == ".cmake") @@ -183,7 +183,7 @@ namespace vcpkg::PostBuildLint static LintStatus check_for_dlls_in_lib_dir(const Files::Filesystem& fs, const fs::path& package_dir) { - std::vector<fs::path> dlls = fs.recursive_find_all_files_in_dir(package_dir / "lib"); + std::vector<fs::path> dlls = fs.get_files_recursive(package_dir / "lib"); Util::unstable_keep_if(dlls, has_extension_pred(fs, ".dll")); if (!dlls.empty()) @@ -209,14 +209,13 @@ namespace vcpkg::PostBuildLint std::vector<fs::path> potential_copyright_files; // We only search in the root of each unpacked source archive to reduce false positives - auto src_dirs = fs.non_recursive_find_all_files_in_dir(current_buildtrees_dir_src); + auto src_dirs = fs.get_files_non_recursive(current_buildtrees_dir_src); for (auto&& src_dir : src_dirs) { if (!fs.is_directory(src_dir)) continue; - auto src_files = fs.non_recursive_find_all_files_in_dir(src_dir); - for (auto&& src_file : src_files) + for (auto&& src_file : fs.get_files_non_recursive(src_dir)) { const std::string filename = src_file.filename().string(); @@ -246,7 +245,7 @@ namespace vcpkg::PostBuildLint static LintStatus check_for_exes(const Files::Filesystem& fs, const fs::path& package_dir) { - std::vector<fs::path> exes = fs.recursive_find_all_files_in_dir(package_dir / "bin"); + std::vector<fs::path> exes = fs.get_files_recursive(package_dir / "bin"); Util::unstable_keep_if(exes, has_extension_pred(fs, ".exe")); if (!exes.empty()) @@ -497,7 +496,7 @@ namespace vcpkg::PostBuildLint static LintStatus check_no_empty_folders(const Files::Filesystem& fs, const fs::path& dir) { - std::vector<fs::path> empty_directories = fs.recursive_find_all_files_in_dir(dir); + std::vector<fs::path> empty_directories = fs.get_files_recursive(dir); Util::unstable_keep_if(empty_directories, [&fs](const fs::path& current) { @@ -615,7 +614,7 @@ namespace vcpkg::PostBuildLint static LintStatus check_no_files_in_dir(const Files::Filesystem& fs, const fs::path& dir) { - std::vector<fs::path> misplaced_files = fs.non_recursive_find_all_files_in_dir(dir); + std::vector<fs::path> misplaced_files = fs.get_files_non_recursive(dir); Util::unstable_keep_if(misplaced_files, [&fs](const fs::path& path) { const std::string filename = path.filename().generic_string(); @@ -674,9 +673,9 @@ namespace vcpkg::PostBuildLint const fs::path debug_bin_dir = package_dir / "debug" / "bin"; const fs::path release_bin_dir = package_dir / "bin"; - std::vector<fs::path> debug_libs = fs.recursive_find_all_files_in_dir(debug_lib_dir); + std::vector<fs::path> debug_libs = fs.get_files_recursive(debug_lib_dir); Util::unstable_keep_if(debug_libs, has_extension_pred(fs, ".lib")); - std::vector<fs::path> release_libs = fs.recursive_find_all_files_in_dir(release_lib_dir); + std::vector<fs::path> release_libs = fs.get_files_recursive(release_lib_dir); Util::unstable_keep_if(release_libs, has_extension_pred(fs, ".lib")); error_count += check_matching_debug_and_release_binaries(debug_libs, release_libs); @@ -693,9 +692,9 @@ namespace vcpkg::PostBuildLint { case LinkageType::BackingEnum::DYNAMIC: { - std::vector<fs::path> debug_dlls = fs.recursive_find_all_files_in_dir(debug_bin_dir); + std::vector<fs::path> debug_dlls = fs.get_files_recursive(debug_bin_dir); Util::unstable_keep_if(debug_dlls, has_extension_pred(fs, ".dll")); - std::vector<fs::path> release_dlls = fs.recursive_find_all_files_in_dir(release_bin_dir); + std::vector<fs::path> release_dlls = fs.get_files_recursive(release_bin_dir); Util::unstable_keep_if(release_dlls, has_extension_pred(fs, ".dll")); error_count += check_matching_debug_and_release_binaries(debug_dlls, release_dlls); @@ -716,7 +715,7 @@ namespace vcpkg::PostBuildLint } case LinkageType::BackingEnum::STATIC: { - std::vector<fs::path> dlls = fs.recursive_find_all_files_in_dir(package_dir); + std::vector<fs::path> dlls = fs.get_files_recursive(package_dir); Util::unstable_keep_if(dlls, has_extension_pred(fs, ".dll")); error_count += check_no_dlls_present(dlls); diff --git a/toolsrc/src/VcpkgPaths.cpp b/toolsrc/src/VcpkgPaths.cpp index 49f50f270..5f80fb3b0 100644 --- a/toolsrc/src/VcpkgPaths.cpp +++ b/toolsrc/src/VcpkgPaths.cpp @@ -214,7 +214,7 @@ namespace vcpkg bool VcpkgPaths::is_valid_triplet(const Triplet& t) const { - for (auto&& path : get_filesystem().non_recursive_find_all_files_in_dir(this->triplets)) + for (auto&& path : get_filesystem().get_files_non_recursive(this->triplets)) { std::string triplet_file_name = path.stem().generic_u8string(); if (t.canonical_name() == triplet_file_name) // TODO: fuzzy compare @@ -283,7 +283,7 @@ namespace vcpkg // Locate the "best" MSVC toolchain version const fs::path msvc_path = vc_dir / "Tools" / "MSVC"; - std::vector<fs::path> msvc_subdirectories = paths.get_filesystem().non_recursive_find_all_files_in_dir(msvc_path); + std::vector<fs::path> msvc_subdirectories = fs.get_files_non_recursive(msvc_path); Util::unstable_keep_if(msvc_subdirectories, [&fs](const fs::path& path) { return fs.is_directory(path); }); diff --git a/toolsrc/src/commands_cache.cpp b/toolsrc/src/commands_cache.cpp index c7096b127..cb26c6ef9 100644 --- a/toolsrc/src/commands_cache.cpp +++ b/toolsrc/src/commands_cache.cpp @@ -10,7 +10,7 @@ namespace vcpkg::Commands::Cache static std::vector<BinaryParagraph> read_all_binary_paragraphs(const VcpkgPaths& paths) { std::vector<BinaryParagraph> output; - for (auto&& path : paths.get_filesystem().non_recursive_find_all_files_in_dir(paths.packages)) + for (auto&& path : paths.get_filesystem().get_files_non_recursive(paths.packages)) { const Expected<std::unordered_map<std::string, std::string>> pghs = Paragraphs::get_single_paragraph(paths.get_filesystem(), path / "CONTROL"); if (auto p = pghs.get()) diff --git a/toolsrc/src/commands_help.cpp b/toolsrc/src/commands_help.cpp index e2e504fbf..0c6b0c766 100644 --- a/toolsrc/src/commands_help.cpp +++ b/toolsrc/src/commands_help.cpp @@ -7,7 +7,7 @@ namespace vcpkg::Commands::Help void help_topic_valid_triplet(const VcpkgPaths& paths) { System::println("Available architecture triplets:"); - for (auto&& path : paths.get_filesystem().non_recursive_find_all_files_in_dir(paths.triplets)) + for (auto&& path : paths.get_filesystem().get_files_non_recursive(paths.triplets)) { System::println(" %s", path.stem().filename().string()); } diff --git a/toolsrc/src/commands_import.cpp b/toolsrc/src/commands_import.cpp index b65f636eb..95e23302d 100644 --- a/toolsrc/src/commands_import.cpp +++ b/toolsrc/src/commands_import.cpp @@ -20,7 +20,7 @@ namespace vcpkg::Commands::Import static Binaries find_binaries_in_dir(const Files::Filesystem& fs, const fs::path& path) { - auto files = fs.recursive_find_all_files_in_dir(path); + auto files = fs.get_files_recursive(path); check_is_directory(VCPKG_LINE_INFO, fs, path); diff --git a/toolsrc/src/commands_install.cpp b/toolsrc/src/commands_install.cpp index 32460b807..ce3cbc942 100644 --- a/toolsrc/src/commands_install.cpp +++ b/toolsrc/src/commands_install.cpp @@ -30,7 +30,7 @@ namespace vcpkg::Commands::Install fs.create_directory(installed_subfolder_path, ec); output.push_back(Strings::format(R"(%s/)", triplet_string)); - auto files = fs.recursive_find_all_files_in_dir(package_prefix_path); + auto files = fs.get_files_recursive(package_prefix_path); for (auto&& file : files) { auto status = fs.status(file, ec); @@ -119,7 +119,7 @@ namespace vcpkg::Commands::Install static SortedVector<std::string> build_list_of_package_files(const Files::Filesystem& fs, const fs::path& package_dir) { - const std::vector<fs::path> package_file_paths = fs.recursive_find_all_files_in_dir(package_dir); + const std::vector<fs::path> package_file_paths = fs.get_files_recursive(package_dir); const size_t package_remove_char_count = package_dir.generic_string().size() + 1; // +1 for the slash auto package_files = Util::fmap(package_file_paths, [package_remove_char_count](const fs::path& path) { diff --git a/toolsrc/src/vcpkg_Files.cpp b/toolsrc/src/vcpkg_Files.cpp index ba7bcc222..ac32e39f7 100644 --- a/toolsrc/src/vcpkg_Files.cpp +++ b/toolsrc/src/vcpkg_Files.cpp @@ -65,7 +65,7 @@ namespace vcpkg::Files return current_dir; } - virtual std::vector<fs::path> recursive_find_all_files_in_dir(const fs::path & dir) const override + virtual std::vector<fs::path> get_files_recursive(const fs::path & dir) const override { std::vector<fs::path> ret; @@ -77,7 +77,7 @@ namespace vcpkg::Files return ret; } - virtual std::vector<fs::path> non_recursive_find_all_files_in_dir(const fs::path & dir) const override + virtual std::vector<fs::path> get_files_non_recursive(const fs::path & dir) const override { std::vector<fs::path> ret; diff --git a/toolsrc/src/vcpkglib.cpp b/toolsrc/src/vcpkglib.cpp index f70f9ace1..60f0413ec 100644 --- a/toolsrc/src/vcpkglib.cpp +++ b/toolsrc/src/vcpkglib.cpp @@ -53,7 +53,7 @@ namespace vcpkg StatusParagraphs current_status_db = load_current_database(fs, status_file, status_file_old); - auto update_files = fs.non_recursive_find_all_files_in_dir(updates_dir); + auto update_files = fs.get_files_non_recursive(updates_dir); if (update_files.empty()) { // updates directory is empty, control file is up-to-date. |
