aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/include
diff options
context:
space:
mode:
Diffstat (limited to 'toolsrc/include')
-rw-r--r--toolsrc/include/BuildInfo.h6
-rw-r--r--toolsrc/include/Paragraphs.h3
-rw-r--r--toolsrc/include/coff_file_reader.h4
-rw-r--r--toolsrc/include/filesystem_fs.h5
-rw-r--r--toolsrc/include/post_build_lint.h4
-rw-r--r--toolsrc/include/vcpkg.h10
-rw-r--r--toolsrc/include/vcpkg_Files.h43
-rw-r--r--toolsrc/include/vcpkg_System.h5
-rw-r--r--toolsrc/include/vcpkg_paths.h4
9 files changed, 55 insertions, 29 deletions
diff --git a/toolsrc/include/BuildInfo.h b/toolsrc/include/BuildInfo.h
index ccf40abbf..9f872385e 100644
--- a/toolsrc/include/BuildInfo.h
+++ b/toolsrc/include/BuildInfo.h
@@ -4,9 +4,7 @@
#include "Paragraphs.h"
#include <regex>
-namespace fs = std::tr2::sys;
-
-namespace vcpkg
+namespace vcpkg { namespace PostBuildLint
{
enum class LinkageType
{
@@ -128,4 +126,4 @@ namespace vcpkg
};
BuildInfo read_build_info(const fs::path& filepath);
-}
+}}
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 <filesystem>
+#include "filesystem_fs.h"
#include <unordered_map>
namespace vcpkg { namespace Paragraphs
{
- namespace fs = std::tr2::sys;
std::vector<std::unordered_map<std::string, std::string>> get_paragraphs(const fs::path& control_path);
std::vector<std::unordered_map<std::string, std::string>> 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 <vector>
#include "MachineType.h"
-#include <filesystem>
+#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 <filesystem>
+
+namespace fs = std::tr2::sys; \ No newline at end of file
diff --git a/toolsrc/include/post_build_lint.h b/toolsrc/include/post_build_lint.h
index bc916a7af..a5fb9149f 100644
--- a/toolsrc/include/post_build_lint.h
+++ b/toolsrc/include/post_build_lint.h
@@ -2,7 +2,7 @@
#include "package_spec.h"
#include "vcpkg_paths.h"
-namespace vcpkg
+namespace vcpkg {namespace PostBuildLint
{
void perform_all_checks(const package_spec& spec, const vcpkg_paths& paths);
-}
+}}
diff --git a/toolsrc/include/vcpkg.h b/toolsrc/include/vcpkg.h
index 81b4d45ba..ef78e213e 100644
--- a/toolsrc/include/vcpkg.h
+++ b/toolsrc/include/vcpkg.h
@@ -1,6 +1,5 @@
#pragma once
-#include <filesystem>
#include "package_spec.h"
#include "BinaryParagraph.h"
#include "StatusParagraphs.h"
@@ -8,21 +7,16 @@
namespace vcpkg
{
- namespace fs = std::tr2::sys;
-
- extern bool g_do_dry_run;
-
StatusParagraphs database_load_check(const vcpkg_paths& paths);
- void install_package(const vcpkg_paths& paths, const BinaryParagraph& binary_paragraph, StatusParagraphs& status_db);
- void deinstall_package(const vcpkg_paths& paths, const package_spec& spec, StatusParagraphs& status_db);
+ void write_update(const vcpkg_paths& paths, const StatusParagraph& p);
expected<SourceParagraph> try_load_port(const fs::path& control_path);
+
inline expected<SourceParagraph> try_load_port(const vcpkg_paths& paths, const std::string& name)
{
return try_load_port(paths.ports / name);
}
expected<BinaryParagraph> try_load_cached_package(const vcpkg_paths& paths, const package_spec& spec);
-
} // namespace vcpkg
diff --git a/toolsrc/include/vcpkg_Files.h b/toolsrc/include/vcpkg_Files.h
index 445713965..8b320303d 100644
--- a/toolsrc/include/vcpkg_Files.h
+++ b/toolsrc/include/vcpkg_Files.h
@@ -1,17 +1,52 @@
#pragma once
#include "expected.h"
-#include <filesystem>
+#include "filesystem_fs.h"
+#include <iterator>
namespace vcpkg {namespace Files
{
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<std::string> get_contents(const std::tr2::sys::path& file_path) noexcept;
+ expected<std::string> 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 <class Pred>
+ void non_recursive_find_matching_paths_in_dir(const fs::path& dir, const Pred predicate, std::vector<fs::path>* output)
+ {
+ std::copy_if(fs::directory_iterator(dir), fs::directory_iterator(), std::back_inserter(*output), predicate);
+ }
+
+ template <class Pred>
+ void recursive_find_matching_paths_in_dir(const fs::path& dir, const Pred predicate, std::vector<fs::path>* output)
+ {
+ std::copy_if(fs::recursive_directory_iterator(dir), fs::recursive_directory_iterator(), std::back_inserter(*output), predicate);
+ }
+
+ template <class Pred>
+ std::vector<fs::path> recursive_find_matching_paths_in_dir(const fs::path& dir, const Pred predicate)
+ {
+ std::vector<fs::path> v;
+ recursive_find_matching_paths_in_dir(dir, predicate, &v);
+ return v;
+ }
+
+ void recursive_find_files_with_extension_in_dir(const fs::path& dir, const std::string& extension, std::vector<fs::path>* output);
+
+ std::vector<fs::path> recursive_find_files_with_extension_in_dir(const fs::path& dir, const std::string& extension);
+
+ void recursive_find_all_files_in_dir(const fs::path& dir, std::vector<fs::path>* output);
+
+ std::vector<fs::path> recursive_find_all_files_in_dir(const fs::path& dir);
+
+ void non_recursive_find_all_files_in_dir(const fs::path& dir, std::vector<fs::path>* output);
+
+ std::vector<fs::path> non_recursive_find_all_files_in_dir(const fs::path& dir);
+
+ void print_paths(const std::vector<fs::path>& paths);
}}
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 <filesystem>
+#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 <filesystem>
+#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<vcpkg_paths> create(const fs::path& vcpkg_root_dir);