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

Support path resolution #228

Merged
merged 5 commits into from
Oct 18, 2023
Merged

Support path resolution #228

merged 5 commits into from
Oct 18, 2023

Conversation

fzhinkin
Copy link
Collaborator

Fixes #223

@fzhinkin fzhinkin linked an issue Oct 12, 2023 that may be closed by this pull request
@fzhinkin fzhinkin force-pushed the fs-implement-resolve branch from 0430ebf to 52b7387 Compare October 12, 2023 12:58
@fzhinkin fzhinkin marked this pull request as ready for review October 12, 2023 15:32
@fzhinkin fzhinkin requested a review from shanshin October 12, 2023 15:33
core/common/src/files/FileSystem.kt Show resolved Hide resolved
}

@Test
fun resolve() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I need to add more tests: to check for an exception if the path does not exist, to check for an absolute path, etc.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added the test for absolute path, all other cases are already there.

It would be nice to test symlink resolution, but we don't have an API for links yet.

core/common/src/files/FileSystem.kt Show resolved Hide resolved
val root = createTempPath()
SystemFileSystem.createDirectories(Path(root, "a", "b"))
val tgt = Path(root, "c", "d")
SystemFileSystem.createDirectories(tgt)

val src = Path(root, "a", "..", "a", ".", "b", "..", "..", "c", ".", "d")
try {
// root/a/../a/./b/../../c/./d -> root/c/d
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@fzhinkin fzhinkin merged commit f85bebd into develop Oct 18, 2023
@fzhinkin fzhinkin deleted the fs-implement-resolve branch October 18, 2023 14:43
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.

Support getting a canonical file Path
2 participants