diff options
Diffstat (limited to 'runtime/src/pe_loader.cpp')
| -rw-r--r-- | runtime/src/pe_loader.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/runtime/src/pe_loader.cpp b/runtime/src/pe_loader.cpp index d44160505..1a2f98a70 100644 --- a/runtime/src/pe_loader.cpp +++ b/runtime/src/pe_loader.cpp | |||
| @@ -186,6 +186,15 @@ std::filesystem::path tls_host_base_path() { | |||
| 186 | } | 186 | } |
| 187 | 187 | ||
| 188 | std::filesystem::path tls_host_clone_dir() { | 188 | std::filesystem::path tls_host_clone_dir() { |
| 189 | if (const char* dir = std::getenv("LEONIDA_TEST_DIR"); dir && *dir) return std::filesystem::path(dir); | ||
| 190 | const char* tmp = std::getenv("TMP"); | ||
| 191 | const char* temp = std::getenv("TEMP"); | ||
| 192 | const char* profile = std::getenv("USERPROFILE"); | ||
| 193 | if ((!tmp || !*tmp) && (!temp || !*temp) && (!profile || !*profile)) { | ||
| 194 | std::error_code ec; | ||
| 195 | auto cwd = std::filesystem::current_path(ec); | ||
| 196 | if (!ec) return cwd; | ||
| 197 | } | ||
| 189 | wchar_t buf[MAX_PATH]; | 198 | wchar_t buf[MAX_PATH]; |
| 190 | DWORD n = GetTempPathW(MAX_PATH, buf); | 199 | DWORD n = GetTempPathW(MAX_PATH, buf); |
| 191 | if (n > 0 && n < MAX_PATH) return std::filesystem::path(buf); | 200 | if (n > 0 && n < MAX_PATH) return std::filesystem::path(buf); |