1
0
Fork 0

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

pull/5184/head
Niels Keurentjes 2016-04-13 23:53:27 +02:00
parent c9534d48c1
commit 4b5375f4c0
1 changed files with 4 additions and 0 deletions

View File

@ -31,6 +31,10 @@ class Platform
return self::getUserDirectory() . substr($path, 1); return self::getUserDirectory() . substr($path, 1);
} }
return preg_replace_callback('#^([\\$%])(\\w+)\\1?(([/\\\\].*)?)#', function($matches) { 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]; return getenv($matches[2]) . $matches[3];
}, $path); }, $path);
} }