• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
FSFileManager strange behaviour on OS X
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FSFileManager strange behaviour on OS X


  • Subject: FSFileManager strange behaviour on OS X
  • From: Tim Fletcher <email@hidden>
  • Date: Fri, 31 Jul 2015 19:46:29 +0100

Hi All,

I have a Chose File dialog for the user to select a file (directory in this case). I retrieve the absolute path of the chosen directory.
However, am not able to list the contents of the directory.

In a Swift playground this is a little demo I made

let fs = NSFileManager.defaultManager()

fs.isReadableFileAtPath("~/Documents")          // false
fs.isReadableFileAtPath("Documents")            // true
fs.isReadableFileAtPath("/Users/tim/Documents") // false


If i print out fs.currentDirectoryPath dI do indeed get a weird path (assuming that this is the root of where the application has been built to and run from)

How may I access files/directories such as “/Users/tim/Documents”?

Many thanks
Tim




_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: FSFileManager strange behaviour on OS X
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Re: NSManagedObject, NSString property retain vs copy
  • Next by Date: Re: FSFileManager strange behaviour on OS X
  • Previous by thread: Re: Regarding these Olivia messages. Can we do something about the list security?
  • Next by thread: Re: FSFileManager strange behaviour on OS X
  • Index(es):
    • Date
    • Thread