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

Symlink handling on Windows #103

Open
BrianHenryIE opened this issue Apr 26, 2024 · 0 comments
Open

Symlink handling on Windows #103

BrianHenryIE opened this issue Apr 26, 2024 · 0 comments
Labels
help wanted Extra attention is needed

Comments

@BrianHenryIE
Copy link
Owner

There are two places where it's trying to delete a symlink, but the unlink() function that works on MacOS and Linux doesn't work on Windows. I don't have a Windows computer to test.

} elseif (false !== strpos('WIN', PHP_OS)
&& stat($file)['nlink'] !== lstat($file)['nlink']
) {
/**
* `unlink()` will not work on Windows. `rmdir()` will not work if there are files in the directory.
* "On windows, take care that `is_link()` returns false for Junctions."
*
* @see https://www.php.net/manual/en/function.is-link.php#113263
* @see https://stackoverflow.com/a/18262809/336146
*/
rmdir($file);

strauss/src/Cleanup.php

Lines 70 to 80 in 1cdb99c

} elseif (false !== strpos('WIN', PHP_OS)
&& stat($absolutePath)['nlink'] !== lstat($absolutePath)['nlink']
) {
/**
* `unlink()` will not work on Windows. `rmdir()` will not work if there are files in the directory.
* "On windows, take care that `is_link()` returns false for Junctions."
*
* @see https://www.php.net/manual/en/function.is-link.php#113263
* @see https://stackoverflow.com/a/18262809/336146
*/
rmdir($absolutePath);

@szaleq Maybe you'd give this a try, please.

@BrianHenryIE BrianHenryIE added the help wanted Extra attention is needed label Apr 27, 2024
@BrianHenryIE BrianHenryIE changed the title Tests don't pass on Windows Symlink handling on Windows Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant