upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/src/pe_loader.cpp
diff options
context:
space:
mode:
authorMoonEyes <ducoinbenjamin@yahoo.fr>2026-11-29 13:44:40 +0100
committerGitHub <noreply@github.com>2026-11-29 13:44:40 +0100
commit44ddf9b0527022b0bcddd3d4f0bf46382fdb94a5 (patch)
treea66e4bd65a3b2e6cb589586225f70e82601ca1a9 /runtime/src/pe_loader.cpp
parent0e7e1059d31b01e4a4ee853c1b7652151ee4c559 (diff)
parentb17397f0dd77280e107de489fc0f2a92471ace60 (diff)
Merge pull request #1600 from thiefyzheng/fix/test-tempdir-stripped-env
Diffstat (limited to 'runtime/src/pe_loader.cpp')
-rw-r--r--runtime/src/pe_loader.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/runtime/src/pe_loader.cpp b/runtime/src/pe_loader.cpp
index 303469b06..49588b424 100644
--- a/runtime/src/pe_loader.cpp
+++ b/runtime/src/pe_loader.cpp
@@ -188,6 +188,15 @@ std::filesystem::path tls_host_base_path() {
188} 188}
189 189
190std::filesystem::path tls_host_clone_dir() { 190std::filesystem::path tls_host_clone_dir() {
191 if (const char* dir = std::getenv("LEONIDA_TEST_DIR"); dir && *dir) return std::filesystem::path(dir);
192 const char* tmp = std::getenv("TMP");
193 const char* temp = std::getenv("TEMP");
194 const char* profile = std::getenv("USERPROFILE");
195 if ((!tmp || !*tmp) && (!temp || !*temp) && (!profile || !*profile)) {
196 std::error_code ec;
197 auto cwd = std::filesystem::current_path(ec);
198 if (!ec) return cwd;
199 }
191 wchar_t buf[MAX_PATH]; 200 wchar_t buf[MAX_PATH];
192 DWORD n = GetTempPathW(MAX_PATH, buf); 201 DWORD n = GetTempPathW(MAX_PATH, buf);
193 if (n > 0 && n < MAX_PATH) return std::filesystem::path(buf); 202 if (n > 0 && n < MAX_PATH) return std::filesystem::path(buf);