Commit 59599289 authored by Alexey.Musinov's avatar Alexey.Musinov

utils

parent 5157908b
...@@ -42,4 +42,5 @@ ...@@ -42,4 +42,5 @@
@interface NSFileManager (Utils) @interface NSFileManager (Utils)
- (BOOL)copyFolderAtPath:(NSString *)sourceFolder toDestinationFolderAtPath:(NSString*)destinationFolder; - (BOOL)copyFolderAtPath:(NSString *)sourceFolder toDestinationFolderAtPath:(NSString*)destinationFolder;
- (NSString*)createTemporaryDirectory; - (NSString*)createTemporaryDirectory;
- (void)createDirectory:(NSString*)directory;
@end @end
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
NSError *error = nil; NSError *error = nil;
NSString* path = [NSString stringWithFormat:@"%@%@", NSTemporaryDirectory(), [NSUUID UUID].UUIDString]; NSString* path = [NSString stringWithFormat:@"%@%@", NSTemporaryDirectory(), [NSUUID UUID].UUIDString];
if(![[NSFileManager defaultManager] createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:&error]) if(![self createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:&error])
{ {
NSLog(@"Could not creat temp path %@. error %@", path, error); NSLog(@"Could not creat temp path %@. error %@", path, error);
return @""; return @"";
...@@ -77,4 +77,11 @@ ...@@ -77,4 +77,11 @@
return path; return path;
} }
- (void)createDirectory:(NSString*)directory {
NSError *error = nil;
if(![self createDirectoryAtPath:directory withIntermediateDirectories:YES attributes:nil error:&error]) {
NSLog(@"Failed to create directory \"%@\". Error: %@", directory, error);
}
}
@end @end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment