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

feat: handle relative symbolic links #98

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

KaiOelfke
Copy link

This should fix tuist/tuist#7145. There may be other or better ways to fix this. But the root issue seems to be handling of an relative symbolic link.

Copy link
Member

@fortmarek fortmarek left a comment

Choose a reason for hiding this comment

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

Thanks a lot for the fix! Two minor comments, after which we can merge 🙂

@@ -549,6 +549,14 @@ public struct FileSystem: FileSysteming, Sendable {
)
}

public func createSymbolicLink(from: AbsolutePath, to: RelativePath) async throws {
Copy link
Member

Choose a reason for hiding this comment

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

You will need to add the method to the FileSysteming protocol.

Comment on lines 553 to 557
logger?.debug("Creating symbolic link from \(from.pathString) to \(to.pathString).")
try await NIOFileSystem.FileSystem.shared.createSymbolicLink(
at: FilePath(from.pathString),
withDestination: FilePath(to.pathString)
)
Copy link
Member

Choose a reason for hiding this comment

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

What do you think about creating a private helper method to combine the two createSymbolicLink methods?

    private func createSymbolicLink(fromPathString: String, toPathString: String) async throws {
        logger?.debug("Creating symbolic link from \(fromPathString) to \(toPathString).")
        try await NIOFileSystem.FileSystem.shared.createSymbolicLink(
            at: FilePath(fromPathString),
            withDestination: FilePath(toPathString)
        )
    }

    public func createSymbolicLink(from: AbsolutePath, to: AbsolutePath) async throws {
        try await createSymbolicLink(fromPathString: from.pathString, toPathString: to.pathString)
    }

@fortmarek fortmarek changed the title Add test and fix handling of relative symbolic links fix: handling of relative symbolic links Dec 20, 2024
@fortmarek fortmarek changed the title fix: handling of relative symbolic links feat: handle relative symbolic links Dec 20, 2024
@KaiOelfke KaiOelfke requested a review from fortmarek December 20, 2024 10:56
@KaiOelfke
Copy link
Author

Thanks a lot for the fix! Two minor comments, after which we can merge 🙂

I made these changes. You can have another look.

Copy link
Member

@fortmarek fortmarek left a comment

Choose a reason for hiding this comment

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

Thanks again 👏

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