diff options
| author | Teddy Wing | 2012-07-21 00:48:13 -0400 |
|---|---|---|
| committer | Teddy Wing | 2012-07-21 00:48:13 -0400 |
| commit | 4c39f3ef9e67ddd6b05fd3c1fb00f5e3b1ca08d6 (patch) | |
| tree | 455c796c9a0e6bed71fdc93806447529eacc470c | |
| parent | 8575b4fe4e7283383154dc5ac016fcfe042dcb56 (diff) | |
| download | On-Task-4c39f3ef9e67ddd6b05fd3c1fb00f5e3b1ca08d6.tar.bz2 | |
Updated Application Support Category to create our ApSup directory if it's not there already.
| -rw-r--r-- | Classes/NSFileManager+DirectoryLocations.m | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Classes/NSFileManager+DirectoryLocations.m b/Classes/NSFileManager+DirectoryLocations.m index 84cf307..9d0363a 100644 --- a/Classes/NSFileManager+DirectoryLocations.m +++ b/Classes/NSFileManager+DirectoryLocations.m @@ -12,7 +12,15 @@ - (NSString *)applicationSupportDirectory { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex: 0] : NSTemporaryDirectory(); - return [basePath stringByAppendingPathComponent:@"On Task"]; + NSString *applicationSupportPath = [basePath stringByAppendingPathComponent:@"On Task"]; + + if (![[NSFileManager defaultManager] fileExistsAtPath:applicationSupportPath]) { + if (![[NSFileManager defaultManager] createDirectoryAtPath:applicationSupportPath attributes:nil]) { + NSLog(@"Error: Could not create folder %@", applicationSupportPath); + } + } + + return applicationSupportPath; } @end |
