소스 검색

libuv: win: honor NoDefaultCurrentDirectoryInExePath env var

Backport commit 5e302730cd (win: honor NoDefaultCurrentDirectoryInExePath
env var, 2023-12-01) from libuv PR 4238.
Kyle Edwards 2 년 전
부모
커밋
ab561b86fb
1개의 변경된 파일6개의 추가작업 그리고 4개의 파일을 삭제
  1. 6 4
      Utilities/cmlibuv/src/win/process.c

+ 6 - 4
Utilities/cmlibuv/src/win/process.c

@@ -391,10 +391,12 @@ static WCHAR* search_path(const WCHAR *file,
   } else {
     dir_end = path;
 
-    /* The file is really only a name; look in cwd first, then scan path */
-    result = path_search_walk_ext(L"", 0,
-                                  file, file_len,
-                                  cwd, cwd_len);
+    if (NeedCurrentDirectoryForExePathW(L"")) {
+      /* The file is really only a name; look in cwd first, then scan path */
+      result = path_search_walk_ext(L"", 0,
+                                    file, file_len,
+                                    cwd, cwd_len);
+    }
 
     while (result == NULL) {
       if (dir_end == NULL || *dir_end == L'\0') {