add create directory api for iOS and macOS
This commit is contained in:
@@ -334,3 +334,17 @@ void save_image_library(const std::string& path)
|
||||
}];
|
||||
#endif
|
||||
}
|
||||
|
||||
bool apple_create_dir(const std::string& path)
|
||||
{
|
||||
NSError* err = nil;
|
||||
NSString* p = [NSString stringWithUTF8String:(path+"/").c_str()];
|
||||
NSURL* url = [NSURL fileURLWithPath:p isDirectory:YES];
|
||||
if (![[NSFileManager defaultManager] createDirectoryAtURL:url withIntermediateDirectories:YES attributes:nil error:&err])
|
||||
{
|
||||
LOG("error creating path: %s", path.c_str());
|
||||
LOG("error creating path: %s", [[err description] cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user