-
Notifications
You must be signed in to change notification settings - Fork 59
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
Implement path normalization #286
base: develop
Are you sure you want to change the base?
Conversation
@@ -174,3 +180,51 @@ private fun removeTrailingSeparatorsWindows(suffixLength: Int, path: String): St | |||
} | |||
return path.substring(0, idx) | |||
} | |||
|
|||
internal fun Path.normalizedInternal(preserveDrive: Boolean, vararg separators: Char): String { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works incorrectly for UNC paths
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will fix it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok!
} | ||
val parts = stringRepresentation.split(*separators) | ||
val constructedPath = mutableListOf<String>() | ||
for (idx in parts.indices) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not for (part in parts)
?
append(drive) | ||
var skipFirstSeparator = true | ||
if (isAbs) { | ||
append(SystemPathSeparator) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or skipFirstSeparator = false
:)
@@ -174,3 +180,51 @@ private fun removeTrailingSeparatorsWindows(suffixLength: Int, path: String): St | |||
} | |||
return path.substring(0, idx) | |||
} | |||
|
|||
internal fun Path.normalizedInternal(preserveDrive: Boolean, vararg separators: Char): String { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok!
Closes #223