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

Fix windows creation of relative symlinks to directories #931

Merged
merged 3 commits into from
Sep 23, 2024

Conversation

jmschonfeld
Copy link
Contributor

On windows, we need to specify an extra flag if we are creating a symlink to a directory. To do this, we check if the provided destination is a directory using FileManager.fileExists(atPath:isDirectory:). However, the destination path is relative to the symlink and not relative to the current working directory like fileExists(atPath:) expects so we must first convert the relative path into an absolute path using the symlink path as a base.

Resolves #928

@jmschonfeld
Copy link
Contributor Author

@swift-ci please test

Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but the test case would be nice.

@jmschonfeld
Copy link
Contributor Author

@swift-ci please test

@jmschonfeld
Copy link
Contributor Author

@swift-ci please test Linux platform

@jmschonfeld
Copy link
Contributor Author

@swift-ci please test

@jmschonfeld
Copy link
Contributor Author

@swift-ci please test Windows platform

@jmschonfeld
Copy link
Contributor Author

@swift-ci please test macOS platform

@jmschonfeld jmschonfeld merged commit d1da0f7 into swiftlang:main Sep 23, 2024
3 checks passed
@jmschonfeld jmschonfeld deleted the windows/relative-symlink branch September 23, 2024 17:04
jmschonfeld added a commit to jmschonfeld/swift-foundation that referenced this pull request Sep 23, 2024
* Fix windows creation of relative symlinks to directories

* Add additional unit tests

* Fix windows test failure
jmschonfeld added a commit to jmschonfeld/swift-foundation that referenced this pull request Sep 23, 2024
* Fix windows creation of relative symlinks to directories

* Add additional unit tests

* Fix windows test failure
jmschonfeld added a commit that referenced this pull request Sep 26, 2024
* Fix windows creation of relative symlinks to directories

* Add additional unit tests

* Fix windows test failure
jmschonfeld added a commit that referenced this pull request Sep 26, 2024
* Fix windows creation of relative symlinks to directories

* Add additional unit tests

* Fix windows test failure
cthielen pushed a commit to cthielen/swift-foundation that referenced this pull request Nov 8, 2024
* Fix windows creation of relative symlinks to directories

* Add additional unit tests

* Fix windows test failure
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.

Windows: symbolic links not created correctly with relative paths
3 participants