osx - How to stop xcode debugger from mangling filesystem NSURLs on OS X? -
i trying write mac app converts files. stuck @ beginning because app cannot open local files, @ least while running in debugger. use nsopenpanel create valid file nsurl:
“file:///volumes/seagate_1tib/projects/dataskunk/wasteproduct.xml”
but somewhere in xcode, or debugger or whatever, gets mangled into
"/users/charlweed/library/developer/xcode/deriveddata/dataskunk-ghkiumvdkopxarhavynetidlqxio/build/products/debug/file:/volumes/bigdrive/dataskunk/wasteproduct.xml"
reading file fails "no such file or directory error".
how prevent mangling during development?
for example, gives error, no matter file chosen:
let fileresult = openfiledialog("choose file", message:"message") let xmlinfileurlopt: nsurl? = nsurl.fileurlwithpath(fileresult) if let xmlinfileurl = xmlinfileurlopt { var xmlfileerror: nserror? if !xmlinfileurl.checkpromiseditemisreachableandreturnerror(&xmlfileerror){ println("\(xmlfileerror)") return } }
the answer nsurl.fileurlwithpath()
not take url-path argument, filesystem-path. "file:///volumes/disk/file.xml"
wrong, "/volumes/disk/file.xml"
correct.
the mangling nsurl prefixing current directory onto thinks relative filesystem-path string.
Comments
Post a Comment