소스 검색

Need legacy patch for older hardcoded behaviour in handling HOME/USERPROFILE env variables.

Niels Keurentjes 9 년 전
부모
커밋
4b5375f4c0
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      src/Composer/Util/Platform.php

+ 4 - 0
src/Composer/Util/Platform.php

@@ -31,6 +31,10 @@ class Platform
             return self::getUserDirectory() . substr($path, 1);
         }
         return preg_replace_callback('#^([\\$%])(\\w+)\\1?(([/\\\\].*)?)#', function($matches) {
+            // Treat HOME as an alias for USERPROFILE on Windows for legacy reasons
+            if (Platform::isWindows() && $matches[2] == 'HOME') {
+                return (getenv('HOME') ?: getenv('USERPROFILE')) . $matches[3];
+            }
             return getenv($matches[2]) . $matches[3];
         }, $path);
     }