From 4b5375f4c07b4d29462820f52aeca42ef204f805 Mon Sep 17 00:00:00 2001 From: Niels Keurentjes Date: Wed, 13 Apr 2016 23:53:27 +0200 Subject: [PATCH] Need legacy patch for older hardcoded behaviour in handling HOME/USERPROFILE env variables. --- src/Composer/Util/Platform.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Composer/Util/Platform.php b/src/Composer/Util/Platform.php index 71aa028c5..7e0bf1dab 100644 --- a/src/Composer/Util/Platform.php +++ b/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); }