aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/include/vcpkg_System.h
diff options
context:
space:
mode:
authorJan HrubĂ˝ <jhruby.web@gmail.com>2017-03-13 08:56:05 +0100
committerGitHub <noreply@github.com>2017-03-13 08:56:05 +0100
commit665f4118f603c5858217ed7a2f2f824b18ff4fc5 (patch)
treef0167041edf71e90f2331b5025f603392a8de67a /toolsrc/include/vcpkg_System.h
parent1bec0fcb73073b5b1719f454c368a63f1bff625e (diff)
parent1c9873a0daf625f67474aaf3e163c592c27ecb65 (diff)
downloadvcpkg-665f4118f603c5858217ed7a2f2f824b18ff4fc5.tar.gz
vcpkg-665f4118f603c5858217ed7a2f2f824b18ff4fc5.zip
Merge pull request #1 from Microsoft/master
pull
Diffstat (limited to 'toolsrc/include/vcpkg_System.h')
-rw-r--r--toolsrc/include/vcpkg_System.h63
1 files changed, 45 insertions, 18 deletions
diff --git a/toolsrc/include/vcpkg_System.h b/toolsrc/include/vcpkg_System.h
index f47fc9aab..71caeed5e 100644
--- a/toolsrc/include/vcpkg_System.h
+++ b/toolsrc/include/vcpkg_System.h
@@ -1,12 +1,15 @@
#pragma once
+#include <Windows.h>
#include "vcpkg_Strings.h"
+#include "filesystem_fs.h"
+#include "vcpkg_optional.h"
-#include <filesystem>
-
-namespace vcpkg {namespace System
+namespace vcpkg::System
{
- std::tr2::sys::path get_exe_path_of_current_process();
+ optional<std::wstring> get_registry_string(HKEY base, const wchar_t* subkey, const wchar_t* valuename);
+
+ fs::path get_exe_path_of_current_process();
struct exit_code_and_output
{
@@ -14,6 +17,13 @@ namespace vcpkg {namespace System
std::string output;
};
+ int cmd_execute_clean(const wchar_t* cmd_line);
+
+ inline int cmd_execute_clean(const std::wstring& cmd_line)
+ {
+ return cmd_execute_clean(cmd_line.c_str());
+ }
+
int cmd_execute(const wchar_t* cmd_line);
inline int cmd_execute(const std::wstring& cmd_line)
@@ -28,6 +38,10 @@ namespace vcpkg {namespace System
return cmd_execute_and_capture_output(cmd_line.c_str());
}
+ std::wstring create_powershell_script_cmd(const fs::path& script_path);
+
+ std::wstring create_powershell_script_cmd(const fs::path& script_path, const std::wstring& args);
+
enum class color
{
success = 10,
@@ -37,8 +51,28 @@ namespace vcpkg {namespace System
void print(const char* message);
void println(const char* message);
- void print(color c, const char* message);
- void println(color c, const char* message);
+ void print(const color c, const char* message);
+ void println(const color c, const char* message);
+
+ inline void print(const std::string& message)
+ {
+ return print(message.c_str());
+ }
+
+ inline void println(const std::string& message)
+ {
+ return println(message.c_str());
+ }
+
+ inline void print(const color c, const std::string& message)
+ {
+ return print(c, message.c_str());
+ }
+
+ inline void println(const color c, const std::string& message)
+ {
+ return println(c, message.c_str());
+ }
template <class...Args>
void print(const char* messageTemplate, const Args&... messageArgs)
@@ -47,7 +81,7 @@ namespace vcpkg {namespace System
}
template <class...Args>
- void print(color c, const char* messageTemplate, const Args&... messageArgs)
+ void print(const color c, const char* messageTemplate, const Args&... messageArgs)
{
return print(c, Strings::format(messageTemplate, messageArgs...).c_str());
}
@@ -59,19 +93,12 @@ namespace vcpkg {namespace System
}
template <class...Args>
- void println(color c, const char* messageTemplate, const Args&... messageArgs)
+ void println(const color c, const char* messageTemplate, const Args&... messageArgs)
{
return println(c, Strings::format(messageTemplate, messageArgs...).c_str());
}
- struct Stopwatch
- {
- int64_t start_time, end_time, freq;
-
- void start();
- void stop();
- double microseconds() const;
- };
+ optional<std::wstring> get_environmental_variable(const wchar_t* varname) noexcept;
- std::wstring wdupenv_str(const wchar_t* varname) noexcept;
-}}
+ void set_environmental_variable(const wchar_t* varname, const wchar_t* varvalue) noexcept;
+}