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

No fallback to copy when symlink fails #2

Open
jurrianvaniersel opened this issue Sep 27, 2017 · 3 comments
Open

No fallback to copy when symlink fails #2

jurrianvaniersel opened this issue Sep 27, 2017 · 3 comments

Comments

@jurrianvaniersel
Copy link

On filesystems that do not support symlinks (for example on Windows), there's no fallback to making a copy of the file when symlinking fails.

Solution would be something like this:

if (!$fs->relativeSymlink($targetPath, $linkPath)) {
    $fs->copy($targetPath, $linkPath);
}
@ajgarlag
Copy link
Owner

I see your problem. Although the component is called symlinker the copy could be an acceptable fallback. Please, open a Pull Request.

@ajgarlag
Copy link
Owner

@jurrianvaniersel If you are using a NTFS filesystem, can you test the ntfs-junction branch?

@jurrianvaniersel
Copy link
Author

Sorry, it does not work. I am using it on a Linux-box in Virtualbox on a Virtualbox filesystem (which is actually a folder on my Windows laptop).

You're checking Platform::isWindows(), but you can use filesystems without symlink-support on Linux of *BSD. I would go for checking the result of $fs->relativeSymlink(). If it's false, symlinking failed and you can try $fs->junction().

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

No branches or pull requests

2 participants