Skip to content
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

Closed
wants to merge 1 commit into from
Closed

Copy file if symlinking fails #3

wants to merge 1 commit into from

Conversation

jurrianvaniersel
Copy link

@jurrianvaniersel jurrianvaniersel commented Oct 2, 2017

Solved issue #2: Fallback mechanism for filesystems that do not support symlinks (for example: Windows)

@@ -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)) {
Copy link
Owner

@ajgarlag ajgarlag Oct 2, 2017

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?

Copy link
Author

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.

Copy link
Owner

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

Copy link
Author

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.

Copy link
Owner

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?

@jurrianvaniersel
Copy link
Author

I would prefer using composer's copy-function

@ajgarlag
Copy link
Owner

ajgarlag commented Oct 3, 2017

No problem for me, let's wait for next composer version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants