• 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
Re: Insuring a path exists
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Insuring a path exists


  • Subject: Re: Insuring a path exists
  • From: Stephane Sudre <email@hidden>
  • Date: Wed, 9 Jun 2004 11:03:02 +0200

On mercredi, juin 9, 2004, at 05:55 AM, David Sinclair wrote:

On Jun 8, 2004, at 19:54, Mike O'Connor wrote:

I have a path like this:

NSString* thePath=@"/Library/Application Support/MyApp/MySubfolder/file.typ"

I want to insure that folders MyApp and MySubfolder exist, so that when I do a writeToFile: using that path, it will succeed.

Is there a call I can make to insure the path exists, creating the folders if needed, or do I have to write some code going through the components of the path and doing it myself? TIA!

Here are a couple of methods I use, via a category on NSString:
[...]

The code is good but IMHO, it can't work correctly in the exposed case. Because if "Application Support" is missing, the folder will be created with the User Mask and with the wrong owner and group in most of the cases.

The absolute path does not include enough information to rebuild the hierarchy if needed.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Re: Insuring a path exists (From: David Sinclair <email@hidden>)

  • Prev by Date: Re: Best Practice for implementing NSUndoManager?
  • Next by Date: Re: Getting the version string of any program
  • Previous by thread: Re: Insuring a path exists
  • Next by thread: Re: Insuring a path exists
  • Index(es):
    • Date
    • Thread