Re: Creating directories if they don't exist
Re: Creating directories if they don't exist
- Subject: Re: Creating directories if they don't exist
- From: Hasan Diwan <email@hidden>
- Date: Tue, 16 Sep 2003 20:35:34 +0200
Francisco:
if ([[NSFileManager defaultManager] fileExistsAtPath:[NSString
stringWithFormat:@"%@/Documents/somethingnew", NSHomeDirectory()]
isDirectory:YES]) {
if ([[[[NSFileManager defaultManager] fileExistsAtPath:[NSString
stringWithFormat:@"%@/Documents/somethingnew/somethingelseNew",
NSHomeDirectory()] isDirectory:YES]) { return; } [[NSFileManager
defaultManager] createDirectoryAtPath: [NSString
stringWithFormat:@"%@/Documents/somethingnew/somethingelseNew",
NSHomeDirectory()]]; }
[[NSFileManager defaultManager] createDirectoryAtPath: [NSString
stringWithFormat:@"%@/Documents/somethingnew", NSHomeDirectory()]];
}
Untested code, so caveat emptor.
On Tuesday, Sep 16, 2003, at 08:01 Europe/Copenhagen, Francisco
Tolmasky wrote:
In Project Builder, with the assistant, if you put a a path and some
of the components don't exist it will create them for you. For
example, ~/Documents/somethingnew/somethingelseNew/ then it creates
somethingnew and somethingelseNew for you. Is there a built in
function to do this, or will I have to manually check path component
by path component to see whether it exists and whether it will need to
be created?
Any help is greatly appreciated and thanks in advance :),
Francisco Tolmasky
email@hidden
http://users.adelphia.net/~ftolmasky
_______________________________________________
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.
Hasan Diwan {
http://ibn.com/~hdiwan}
OpenPGP Fingerprint: 275D 0E84 550C D92A 4A56 732C 8528 2579 E6E9 4842
_______________________________________________
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.