Skip to content

Instantly share code, notes, and snippets.

@mutekinootoko
Created July 16, 2015 11:25
Show Gist options
  • Save mutekinootoko/94e219f9ccf8f6b6d64c to your computer and use it in GitHub Desktop.
Save mutekinootoko/94e219f9ccf8f6b6d64c to your computer and use it in GitHub Desktop.
generates temp folder
- (NSString*) tempFolderPath {
if(_tempFolderPath == nil) {
NSError* err;
_tempFolderPath = [NSTemporaryDirectory() stringByAppendingPathComponent:[[NSProcessInfo processInfo] globallyUniqueString]];
[[NSFileManager defaultManager] createDirectoryAtPath:_tempFolderPath withIntermediateDirectories:YES attributes:nil error:&err];
NSLog(@"temporary folder created at %@", _tempFolderPath);
if(err) {
NSLog(@"error when creating temporary folder. %@", err);
// TODO better error handler
}
}
return _tempFolderPath;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment