소스 검색

fix for Windows build when "." is not explicitly on the PATH

David Rose 13 년 전
부모
커밋
2c1dcdb7b4
1개의 변경된 파일11개의 추가작업 그리고 4개의 파일을 삭제
  1. 11 4
      makepanda/makepandacore.py

+ 11 - 4
makepanda/makepandacore.py

@@ -410,11 +410,18 @@ def LocateBinary(binary):
     else:
     else:
         p = os.environ["PATH"]
         p = os.environ["PATH"]
 
 
-    # Append .exe if necessary
-    if GetHost() == 'windows' and not binary.endswith('.exe'):
-        binary += '.exe'
+    pathList = p.split(os.pathsep)
+    
+    if GetHost() == 'windows':
+        if not binary.endswith('.exe'):
+            # Append .exe if necessary
+            binary += '.exe'
+
+        # On Windows the current directory is always implicitly
+        # searched before anything else on PATH.
+        pathList = ['.'] + pathList
 
 
-    for path in p.split(os.pathsep):
+    for path in pathList:
         binpath = os.path.join(os.path.expanduser(path), binary)
         binpath = os.path.join(os.path.expanduser(path), binary)
         if os.access(binpath, os.X_OK):
         if os.access(binpath, os.X_OK):
             return os.path.abspath(os.path.realpath(binpath))
             return os.path.abspath(os.path.realpath(binpath))