10000 [FileSystem] explains possible failure of symlink creation in windows · symfony/symfony@8eca661 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8eca661

Browse files
author
Erik Trapman
committed
[FileSystem] explains possible failure of symlink creation in windows
1 parent b1f8744 commit 8eca661

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Symfony/Component/Filesystem/Filesystem.php

+6
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,12 @@ public function symlink($originDir, $targetDir, $copyOnWindows = false)
275275

276276
if (!$ok) {
277277
if (true !== @symlink($originDir, $targetDir)) {
278+
$report = error_get_last();
279+
if (is_array($report)) {
280+
if (defined('PHP_WINDOWS_VERSION_MAJOR') && false !== strpos($report['message'], 'error code(1314)')) {
281+
throw new IOException('Unable to create symlink due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?');
282+
}
283+
}
278284
throw new IOException(sprintf('Failed to create symbolic link from %s to %s', $originDir, $targetDir));
279285
}
280286
}

0 commit comments

Comments
 (0)
0