You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import Foundation
letfile=URL(fileURLWithPath:"main.swift")letdir= file.deletingLastPathComponent()print(dir.relativePath)// => print(dir.appendingPathComponent("main.swift").path)// => /main.swift
Since main.swift represents a relative path from the current directory, removing the last component should result in . to indicate the current directory. However, it incorrectly results in an empty path ``.
When combined with the bug #921, this behavior causes the path to change unexpectedly when re-adding the removed component, resulting in a different path from the original file.
On macOS, the result is . as expected, so re-adding the removed component restores the path to the original file.
The text was updated successfully, but these errors were encountered:
As described in the title, the following occurs:
Since
main.swift
represents a relative path from the current directory, removing the last component should result in.
to indicate the current directory. However, it incorrectly results in an empty path ``.When combined with the bug #921, this behavior causes the path to change unexpectedly when re-adding the removed component, resulting in a different path from the original file.
On macOS, the result is
.
as expected, so re-adding the removed component restores the path to the original file.The text was updated successfully, but these errors were encountered: