Skip to content

Windows: symbolic links not created correctly with relative paths #928

Closed
@dschaefer2

Description

@dschaefer2

SwiftPM creates a symbolic link in the .build directory to a sibling directory for backwards compatibility reasons. That link is currently in 6.0 not created correctly on Windows.

For Windows we check whether the destPath is a directory to add the SYMBOLIC_LINK_FLAG_DIRECTORY flag when creating the link. However, we don't check whether it's a relative path and just call fileExists to fetch the isDirectory boolean. That assumes the path is relative to the current directory not the symbolic link path.

I notice in corelibs-foundation, the path is resolved correctly before checking if it's a directory:

                let resolvedDest =
                  destPath.isAbsolutePath ? destPath
                                          : joinPath(prefix: path.deletingLastPathComponent,
                                                     suffix: destPath)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions