This commit is contained in:
		| @@ -21,6 +21,7 @@ | ||||
| */ | ||||
| #include "utils/file_directory.hpp" | ||||
|  | ||||
| #include "utils/com_init_wrapper.hpp" | ||||
| #include "utils/common.hpp" | ||||
| #include "utils/error.hpp" | ||||
| #include "utils/string.hpp" | ||||
| @@ -172,6 +173,8 @@ auto directory::create_directory(std::string_view path) const | ||||
|     } | ||||
|  | ||||
| #if defined(_WIN32) | ||||
|     [[maybe_unused]] static const utils::com_init_wrapper wrapper; | ||||
|  | ||||
|     auto res = ::SHCreateDirectory(nullptr, | ||||
|                                    utils::string::from_utf8(abs_path).c_str()); | ||||
|     if (res != ERROR_SUCCESS) { | ||||
|   | ||||
| @@ -23,6 +23,7 @@ | ||||
|  | ||||
| #include "utils/windows.hpp" | ||||
|  | ||||
| #include "utils/com_init_wrapper.hpp" | ||||
| #include "utils/error.hpp" | ||||
| #include "utils/file.hpp" | ||||
| #include "utils/path.hpp" | ||||
| @@ -65,6 +66,8 @@ auto get_last_error_code() -> DWORD { return ::GetLastError(); } | ||||
| auto get_local_app_data_directory() -> const std::string & { | ||||
|   REPERTORY_USES_FUNCTION_NAME(); | ||||
|  | ||||
|   [[maybe_unused]] static const utils::com_init_wrapper wrapper; | ||||
|  | ||||
|   static std::string app_data = ([]() -> std::string { | ||||
|     PWSTR local_app_data{}; | ||||
|     if (SUCCEEDED(::SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, nullptr, | ||||
| @@ -142,6 +145,8 @@ auto run_process_elevated(std::vector<const char *> args) -> int { | ||||
| void set_last_error_code(DWORD error_code) { ::SetLastError(error_code); } | ||||
|  | ||||
| auto get_startup_folder() -> std::wstring { | ||||
|   [[maybe_unused]] static const utils::com_init_wrapper wrapper; | ||||
|  | ||||
|   PWSTR raw{nullptr}; | ||||
|   auto result = ::SHGetKnownFolderPath(FOLDERID_Startup, 0, nullptr, &raw); | ||||
|   if (FAILED(result)) { | ||||
| @@ -160,6 +165,8 @@ auto get_startup_folder() -> std::wstring { | ||||
| auto create_shortcut(const shortcut_cfg &cfg, bool overwrite_existing) -> bool { | ||||
|   REPERTORY_USES_FUNCTION_NAME(); | ||||
|  | ||||
|   [[maybe_unused]] static const utils::com_init_wrapper wrapper; | ||||
|  | ||||
|   const auto hr_hex = [](HRESULT result) -> std::string { | ||||
|     std::ostringstream oss; | ||||
|     oss << "0x" << std::uppercase << std::hex << std::setw(8) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user