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
letdir=URL(fileURLWithPath:"")print(dir.path)// => /tmp/ee78646dddfd6304letfile= dir.appendingPathComponent("main.swift")print(file.path)// => /main.swift
As shown in the example, even though dir holds the path to the current directory, appending a file to it results in an absolute path starting with a slash. This behavior is unexpected because appending to a current directory URL should ideally maintain a relative path, not convert it to an absolute one.
The text was updated successfully, but these errors were encountered:
Problematic Code:
As shown in the example, even though
dir
holds the path to the current directory, appending a file to it results in an absolute path starting with a slash. This behavior is unexpected because appending to a current directory URL should ideally maintain a relative path, not convert it to an absolute one.The text was updated successfully, but these errors were encountered: