1
0
Fork 0

Fixed Windows path separators and updated docs.

pull/5184/head
Niels Keurentjes 2016-04-12 23:51:28 +02:00
parent 7e71b2bfbc
commit f5422a441d
3 changed files with 9 additions and 7 deletions

View File

@ -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 is _not_ possible the package will be copied. In that case, the console will
output `Mirrored from ../../packages/my-package`. output `Mirrored from ../../packages/my-package`.
Instead of default fallback strategy you can force to use symlink with `"symlink": true` or Instead of default fallback strategy you can force to use symlink with `"symlink": true`
mirroring with `"symlink": false` option. or mirroring with `"symlink": false` option.
Forcing mirroring can be useful when deploying or generating package from a monolithic repository. Forcing mirroring can be useful when deploying or generating package from a monolithic repository.
```json ```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 Leading tildes are expanded to the current user's home folder, and environment
can be handy when working on teams on the same packages. For example `~/git/mypackage` will variables are parsed according to host platform. For example `~/git/mypackage`
automatically load the mypackage clone from `/home/<username>/git/mypackage` for every developer. 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 ``?``. > **Note:** Repository paths can also contain wildcards like ``*`` and ``?``.
> For details, see the [PHP glob function](http://php.net/glob). > For details, see the [PHP glob function](http://php.net/glob).

View File

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

View File

@ -29,7 +29,7 @@ class PlatformTest extends \PHPUnit_Framework_TestCase
} else { } else {
$this->assertEquals('/home/test/myPath', Platform::expandPath('$TESTENV/myPath')); $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() public function testIsWindows()