Browse Source

Fixed Windows path separators and updated docs.

Niels Keurentjes 9 years ago
parent
commit
f5422a441d

+ 7 - 5
doc/05-repositories.md

@@ -649,8 +649,8 @@ the console will read `Symlinked from ../../packages/my-package`. If symlinking
 is _not_ possible the package will be copied. In that case, the console will
 output `Mirrored from ../../packages/my-package`.
 
-Instead of default fallback strategy you can force to use symlink with `"symlink": true` or
-mirroring with `"symlink": false` option.
+Instead of default fallback strategy you can force to use symlink with `"symlink": true`
+or mirroring with `"symlink": false` option.
 Forcing mirroring can be useful when deploying or generating package from a monolithic repository.
 
 ```json
@@ -667,9 +667,11 @@ Forcing mirroring can be useful when deploying or generating package from a mono
 }
 ```
 
-If present on *nix systems leading tildes are expanded to the current user's home folder, which
-can be handy when working on teams on the same packages. For example `~/git/mypackage` will
-automatically load the mypackage clone from `/home/<username>/git/mypackage` for every developer.
+Leading tildes are expanded to the current user's home folder, and environment
+variables are parsed according to host platform. For example `~/git/mypackage`
+will automatically load the mypackage clone from `/home/<username>/git/mypackage`,
+which is equivalent to `$HOME/git/mypackage` on Linux/Mac or
+`%USERPROFILE%/git/mypackage` on Windows.
 
 > **Note:** Repository paths can also contain wildcards like ``*`` and ``?``.
 > For details, see the [PHP glob function](http://php.net/glob).

+ 1 - 1
src/Composer/Util/Platform.php

@@ -31,7 +31,7 @@ class Platform
             return self::getUserDirectory() . substr($path, 1);
         }
         return preg_replace_callback(self::isWindows() ? '#^(%(\\w+)%)[/\\\\]#' : '#^(\\$(\\w+))/#', function($matches) {
-            return getenv($matches[2]) . DIRECTORY_SEPARATOR;
+            return getenv($matches[2]) . '/';
         }, $path);
     }
 

+ 1 - 1
tests/Composer/Test/Util/PlatformTest.php

@@ -29,7 +29,7 @@ class PlatformTest extends \PHPUnit_Framework_TestCase
         } else {
             $this->assertEquals('/home/test/myPath', Platform::expandPath('$TESTENV/myPath'));
         }
-        $this->assertEquals((getenv('HOME') ?: getenv('USERPROFILE')) . DIRECTORY_SEPARATOR . 'test', Platform::expandPath('~/test'));
+        $this->assertEquals((getenv('HOME') ?: getenv('USERPROFILE')) . '/test', Platform::expandPath('~/test'));
     }
     
     public function testIsWindows()