From 8eca661c2064315ab8f924bdd9b66c5fc5d89920 Mon Sep 17 00:00:00 2001 From: Erik Trapman Date: Mon, 18 Jun 2012 10:34:56 +0200 Subject: [PATCH] [FileSystem] explains possible failure of symlink creation in windows --- src/Symfony/Component/Filesystem/Filesystem.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php index 5b8480dde4..1b6721bec4 100644 --- a/src/Symfony/Component/Filesystem/Filesystem.php +++ b/src/Symfony/Component/Filesystem/Filesystem.php @@ -275,6 +275,12 @@ class Filesystem if (!$ok) { if (true !== @symlink($originDir, $targetDir)) { + $report = error_get_last(); + if (is_array($report)) { + if (defined('PHP_WINDOWS_VERSION_MAJOR') && false !== strpos($report['message'], 'error code(1314)')) { + 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?'); + } + } throw new IOException(sprintf('Failed to create symbolic link from %s to %s', $originDir, $targetDir)); } }