merged branch SamsonIT/remove_symlink_on_windows (PR #4565)
Commits -------fc3ebb8
[FileSystem] added if-windows check0b58828
[FileSystem] remove symlinks under windows Discussion ---------- [FileSystem] remove symlinks under windows Bug fix: yes Feature addition: no Backwards compatibility break: no Symfony2 tests pass: yes When installing assets on Windows with symlink, the following error occurs when symlink-folders already exist. This PR makes sure symlink-folders are removed under Windows. ``` $ app/console assets:install web --symlink Installing assets using the symlink option Installing assets for Symfony\Bundle\FrameworkBundle into web/bundles/framework [ErrorException] Warning: symlink(): Cannot create symlink, error code(1314) in C:\workspace\erik\roompot\vendor\symfony\symfony\src\Symfony\Component\Filesystem\Filesystem.php line 167 assets:install [--symlink] [--relative] target ``` --------------------------------------------------------------------------- by travisbot at 2012-06-13T09:00:42Z This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1608541) (merged0b58828b
into37550d23
). --------------------------------------------------------------------------- by travisbot at 2012-06-13T14:39:32Z This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1611288) (mergedfc3ebb8c
into0f67ca88
).
This commit is contained in:
commit
c07e9163a6
@ -97,7 +97,12 @@ class Filesystem
|
|||||||
|
|
||||||
rmdir($file);
|
rmdir($file);
|
||||||
} else {
|
} else {
|
||||||
unlink($file);
|
// https://bugs.php.net/bug.php?id=52176
|
||||||
|
if (defined('PHP_WINDOWS_VERSION_MAJOR') && is_dir($file)) {
|
||||||
|
rmdir($file);
|
||||||
|
} else {
|
||||||
|
unlink($file);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -421,6 +421,20 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertTrue(is_link($link));
|
$this->assertTrue(is_link($link));
|
||||||
$this->assertEquals($file, readlink($link));
|
$this->assertEquals($file, readlink($link));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @depends testSymlink
|
||||||
|
*/
|
||||||
|
public function testRemoveSymlink()
|
||||||
|
{
|
||||||
|
$this->markAsSkippedIfSymlinkIsMissing();
|
||||||
|
|
||||||
|
$link = $this->workspace.DIRECTORY_SEPARATOR.'link';
|
||||||
|
|
||||||
|
$this->filesystem->remove($link);
|
||||||
|
|
||||||
|
$this->assertTrue(!is_link($link));
|
||||||
|
}
|
||||||
|
|
||||||
public function testSymlinkIsOverwrittenIfPointsToDifferentTarget()
|
public function testSymlinkIsOverwrittenIfPointsToDifferentTarget()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user