From 0042316c4b57cf91ded8e474a8dda354340e7381 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 29 Nov 2016 18:08:53 -0800 Subject: Introduce filesystem_fs.h --- toolsrc/include/BuildInfo.h | 2 -- toolsrc/include/Paragraphs.h | 3 +-- toolsrc/include/coff_file_reader.h | 4 +--- toolsrc/include/filesystem_fs.h | 5 +++++ toolsrc/include/vcpkg.h | 3 --- toolsrc/include/vcpkg_Files.h | 10 ++++------ toolsrc/include/vcpkg_System.h | 5 ++--- toolsrc/include/vcpkg_paths.h | 4 +--- toolsrc/src/commands_hash.cpp | 2 -- toolsrc/src/commands_search.cpp | 2 -- toolsrc/src/metrics.cpp | 4 +--- toolsrc/src/post_build_lint.cpp | 3 --- toolsrc/src/vcpkg.cpp | 1 - toolsrc/src/vcpkg_Files.cpp | 3 --- toolsrc/src/vcpkg_System.cpp | 2 -- toolsrc/src/vcpkg_metrics_uploader.cpp | 2 -- toolsrc/src/vcpkg_paths.cpp | 1 - toolsrc/vcpkg/vcpkg.vcxproj | 1 + toolsrc/vcpkg/vcpkg.vcxproj.filters | 3 +++ 19 files changed, 19 insertions(+), 41 deletions(-) create mode 100644 toolsrc/include/filesystem_fs.h diff --git a/toolsrc/include/BuildInfo.h b/toolsrc/include/BuildInfo.h index 7c654d9c7..9f872385e 100644 --- a/toolsrc/include/BuildInfo.h +++ b/toolsrc/include/BuildInfo.h @@ -4,8 +4,6 @@ #include "Paragraphs.h" #include -namespace fs = std::tr2::sys; - namespace vcpkg { namespace PostBuildLint { enum class LinkageType diff --git a/toolsrc/include/Paragraphs.h b/toolsrc/include/Paragraphs.h index 22aaefe98..9e9fafe49 100644 --- a/toolsrc/include/Paragraphs.h +++ b/toolsrc/include/Paragraphs.h @@ -1,11 +1,10 @@ #pragma once -#include +#include "filesystem_fs.h" #include namespace vcpkg { namespace Paragraphs { - namespace fs = std::tr2::sys; std::vector> get_paragraphs(const fs::path& control_path); std::vector> parse_paragraphs(const std::string& str); }} diff --git a/toolsrc/include/coff_file_reader.h b/toolsrc/include/coff_file_reader.h index 81f107f10..1a9a071ef 100644 --- a/toolsrc/include/coff_file_reader.h +++ b/toolsrc/include/coff_file_reader.h @@ -1,12 +1,10 @@ #pragma once #include #include "MachineType.h" -#include +#include "filesystem_fs.h" namespace vcpkg {namespace COFFFileReader { - namespace fs = std::tr2::sys; - struct dll_info { MachineType machine_type; diff --git a/toolsrc/include/filesystem_fs.h b/toolsrc/include/filesystem_fs.h new file mode 100644 index 000000000..ece485c23 --- /dev/null +++ b/toolsrc/include/filesystem_fs.h @@ -0,0 +1,5 @@ +#pragma once + +#include + +namespace fs = std::tr2::sys; \ No newline at end of file diff --git a/toolsrc/include/vcpkg.h b/toolsrc/include/vcpkg.h index 81b4d45ba..832fb1920 100644 --- a/toolsrc/include/vcpkg.h +++ b/toolsrc/include/vcpkg.h @@ -1,6 +1,5 @@ #pragma once -#include #include "package_spec.h" #include "BinaryParagraph.h" #include "StatusParagraphs.h" @@ -8,8 +7,6 @@ namespace vcpkg { - namespace fs = std::tr2::sys; - extern bool g_do_dry_run; StatusParagraphs database_load_check(const vcpkg_paths& paths); diff --git a/toolsrc/include/vcpkg_Files.h b/toolsrc/include/vcpkg_Files.h index 8ed1eabe1..aa25d8333 100644 --- a/toolsrc/include/vcpkg_Files.h +++ b/toolsrc/include/vcpkg_Files.h @@ -1,22 +1,20 @@ #pragma once #include "expected.h" -#include +#include "filesystem_fs.h" #include namespace vcpkg {namespace Files { - namespace fs = std::tr2::sys; - static const char* FILESYSTEM_INVALID_CHARACTERS = R"(\/:*?"<>|)"; - void check_is_directory(const std::tr2::sys::path& dirpath); + void check_is_directory(const fs::path& dirpath); bool has_invalid_chars_for_filesystem(const std::string s); - expected get_contents(const std::tr2::sys::path& file_path) noexcept; + expected get_contents(const fs::path& file_path) noexcept; - std::tr2::sys::path find_file_recursively_up(const std::tr2::sys::path& starting_dir, const std::string& filename); + fs::path find_file_recursively_up(const fs::path& starting_dir, const std::string& filename); template void non_recursive_find_matching_paths_in_dir(const fs::path& dir, const Pred predicate, std::vector* output) diff --git a/toolsrc/include/vcpkg_System.h b/toolsrc/include/vcpkg_System.h index c420464c1..e059bde0a 100644 --- a/toolsrc/include/vcpkg_System.h +++ b/toolsrc/include/vcpkg_System.h @@ -1,12 +1,11 @@ #pragma once #include "vcpkg_Strings.h" - -#include +#include "filesystem_fs.h" namespace vcpkg {namespace System { - std::tr2::sys::path get_exe_path_of_current_process(); + fs::path get_exe_path_of_current_process(); struct exit_code_and_output { diff --git a/toolsrc/include/vcpkg_paths.h b/toolsrc/include/vcpkg_paths.h index 2dc9c7636..a2932070d 100644 --- a/toolsrc/include/vcpkg_paths.h +++ b/toolsrc/include/vcpkg_paths.h @@ -1,13 +1,11 @@ #pragma once -#include +#include "filesystem_fs.h" #include "expected.h" #include "package_spec.h" #include "BinaryParagraph.h" namespace vcpkg { - namespace fs = std::tr2::sys; - struct vcpkg_paths { static expected create(const fs::path& vcpkg_root_dir); diff --git a/toolsrc/src/commands_hash.cpp b/toolsrc/src/commands_hash.cpp index 4b89f2894..17c191b78 100644 --- a/toolsrc/src/commands_hash.cpp +++ b/toolsrc/src/commands_hash.cpp @@ -1,8 +1,6 @@ #include "vcpkg_Commands.h" #include "vcpkg_System.h" -namespace fs = std::tr2::sys; - namespace vcpkg { static void do_file_hash(fs::path const& path, std::wstring const& hashType) diff --git a/toolsrc/src/commands_search.cpp b/toolsrc/src/commands_search.cpp index 923368252..a604c5383 100644 --- a/toolsrc/src/commands_search.cpp +++ b/toolsrc/src/commands_search.cpp @@ -4,8 +4,6 @@ #include "vcpkglib_helpers.h" #include "SourceParagraph.h" -namespace fs = std::tr2::sys; - namespace vcpkg { static std::vector read_all_source_paragraphs(const vcpkg_paths& paths) diff --git a/toolsrc/src/metrics.cpp b/toolsrc/src/metrics.cpp index ada065fd6..23962bcfe 100644 --- a/toolsrc/src/metrics.cpp +++ b/toolsrc/src/metrics.cpp @@ -10,12 +10,10 @@ #include #include #include -#include +#include "filesystem_fs.h" #include "vcpkg_Strings.h" #include "vcpkg_System.h" -namespace fs = std::tr2::sys; - namespace vcpkg { static std::string GetCurrentDateTime() diff --git a/toolsrc/src/post_build_lint.cpp b/toolsrc/src/post_build_lint.cpp index 61fbba52a..1a09c99b7 100644 --- a/toolsrc/src/post_build_lint.cpp +++ b/toolsrc/src/post_build_lint.cpp @@ -1,4 +1,3 @@ -#include #include "vcpkg_paths.h" #include "package_spec.h" #include "vcpkg_Files.h" @@ -8,8 +7,6 @@ #include "BuildInfo.h" #include -namespace fs = std::tr2::sys; - namespace vcpkg { namespace PostBuildLint { enum class lint_status diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp index b1fe76982..4b65ea972 100644 --- a/toolsrc/src/vcpkg.cpp +++ b/toolsrc/src/vcpkg.cpp @@ -6,7 +6,6 @@ #include #include #include -#include #include #include #include "vcpkg_Files.h" diff --git a/toolsrc/src/vcpkg_Files.cpp b/toolsrc/src/vcpkg_Files.cpp index 86e7080e4..b86edb4ab 100644 --- a/toolsrc/src/vcpkg_Files.cpp +++ b/toolsrc/src/vcpkg_Files.cpp @@ -1,10 +1,7 @@ #include "vcpkg_Files.h" #include -#include #include -namespace fs = std::tr2::sys; - namespace vcpkg {namespace Files { static const std::regex FILESYSTEM_INVALID_CHARACTERS_REGEX = std::regex(R"([\/:*?"<>|])"); diff --git a/toolsrc/src/vcpkg_System.cpp b/toolsrc/src/vcpkg_System.cpp index cc7080069..cb3eb6584 100644 --- a/toolsrc/src/vcpkg_System.cpp +++ b/toolsrc/src/vcpkg_System.cpp @@ -3,8 +3,6 @@ #include #include -namespace fs = std::tr2::sys; - namespace vcpkg {namespace System { fs::path get_exe_path_of_current_process() diff --git a/toolsrc/src/vcpkg_metrics_uploader.cpp b/toolsrc/src/vcpkg_metrics_uploader.cpp index f1f4a52ed..63668d1d7 100644 --- a/toolsrc/src/vcpkg_metrics_uploader.cpp +++ b/toolsrc/src/vcpkg_metrics_uploader.cpp @@ -1,10 +1,8 @@ #include "metrics.h" -#include #include "vcpkg_Checks.h" #include "vcpkg_Files.h" #include -namespace fs = std::tr2::sys; using namespace vcpkg; int WINAPI diff --git a/toolsrc/src/vcpkg_paths.cpp b/toolsrc/src/vcpkg_paths.cpp index 5347b79d8..b7e716307 100644 --- a/toolsrc/src/vcpkg_paths.cpp +++ b/toolsrc/src/vcpkg_paths.cpp @@ -1,4 +1,3 @@ -#include #include "expected.h" #include "vcpkg_paths.h" #include "metrics.h" diff --git a/toolsrc/vcpkg/vcpkg.vcxproj b/toolsrc/vcpkg/vcpkg.vcxproj index 9d9022229..7fab309d3 100644 --- a/toolsrc/vcpkg/vcpkg.vcxproj +++ b/toolsrc/vcpkg/vcpkg.vcxproj @@ -154,6 +154,7 @@ + diff --git a/toolsrc/vcpkg/vcpkg.vcxproj.filters b/toolsrc/vcpkg/vcpkg.vcxproj.filters index 568850787..cfbb17a22 100644 --- a/toolsrc/vcpkg/vcpkg.vcxproj.filters +++ b/toolsrc/vcpkg/vcpkg.vcxproj.filters @@ -110,5 +110,8 @@ Header Files + + Header Files + \ No newline at end of file -- cgit v1.2.3