Re: Insuring a path exists
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.