-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Copy file if symlinking fails #3
Conversation
@@ -56,7 +56,9 @@ public static function createSymlinks(Event $event) | |||
|
|||
$event->getIO()->write(" Symlinking <comment>$targetPath</comment> to <comment>$linkPath</comment>"); | |||
$fs->ensureDirectoryExists(dirname($linkPath)); | |||
$fs->relativeSymlink($targetPath, $linkPath); | |||
if (!$fs->relativeSymlink($targetPath, $linkPath) && !is_dir($targetPath)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the reason for checking that $targetPath
is not a directory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because PHP's copy-function cannot copy directories.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, but why don't you use the Composer\Util\Filesystem::copy
function as you proposed in #2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because you're using composer 1.0 and Composer\Util\Filesystem::copy
is added recently in a newer version. For me, the impact of upgrading to an newer version of composer is not clear and there are no unit tests the verify the library is still working as expected after an upgrade.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, but I'd prefer not to offer partial support copying only files.
We can wait for the next composer release (upgrading the composer requirement is not a problem here), or provide a custom copy method with support for directories, that can be removed in the future. What do you think?
I would prefer using composer's copy-function |
No problem for me, let's wait for next composer version. |
Solved issue #2: Fallback mechanism for filesystems that do not support symlinks (for example: Windows)