diff --git a/PanoPainter-OSX/Info.plist b/PanoPainter-OSX/Info.plist index 3a69261..76ceea6 100644 --- a/PanoPainter-OSX/Info.plist +++ b/PanoPainter-OSX/Info.plist @@ -27,7 +27,7 @@ LSMinimumSystemVersion $(MACOSX_DEPLOYMENT_TARGET) NSHumanReadableCopyright - Copyright © 2017 Omar Mohamed Ali Mudhir. All rights reserved. + Copyright © 2018 OmixLab Ltd. All rights reserved. NSPrincipalClass NSApplication diff --git a/PanoPainter-OSX/PanoPainter.entitlements b/PanoPainter-OSX/PanoPainter.entitlements new file mode 100644 index 0000000..68dc9db --- /dev/null +++ b/PanoPainter-OSX/PanoPainter.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.assets.pictures.read-write + + + diff --git a/PanoPainter.xcodeproj/project.pbxproj b/PanoPainter.xcodeproj/project.pbxproj index c99a3cd..03b209d 100644 --- a/PanoPainter.xcodeproj/project.pbxproj +++ b/PanoPainter.xcodeproj/project.pbxproj @@ -319,6 +319,7 @@ AD3B1EBF1E3B8B7600E918E3 /* layout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = layout.h; sourceTree = ""; }; AD43267F21599A5B006DE7F6 /* node_usermanual.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = node_usermanual.h; sourceTree = ""; }; AD43268021599A5B006DE7F6 /* node_usermanual.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = node_usermanual.cpp; sourceTree = ""; }; + AD432683215A2B31006DE7F6 /* PanoPainter.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = PanoPainter.entitlements; sourceTree = ""; }; AD4C08CF1E89BD0F0051D85F /* asset.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = asset.cpp; sourceTree = ""; }; AD4C08D01E89BD0F0051D85F /* asset.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = asset.h; sourceTree = ""; }; AD4C08D11E89BD0F0051D85F /* bezier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = bezier.cpp; sourceTree = ""; }; @@ -506,6 +507,7 @@ AD0E5C9D1ECC6F2B00C35669 /* PanoPainter-OSX */ = { isa = PBXGroup; children = ( + AD432683215A2B31006DE7F6 /* PanoPainter.entitlements */, AD0E5CA41ECC6F2B00C35669 /* Assets.xcassets */, AD0E5CA61ECC6F2B00C35669 /* MainMenu.xib */, AD0E5CA91ECC6F2B00C35669 /* Info.plist */, @@ -893,6 +895,11 @@ CreatedOnToolsVersion = 7.2; DevelopmentTeam = ERD9AYQ49S; ProvisioningStyle = Automatic; + SystemCapabilities = { + com.apple.Sandbox = { + enabled = 1; + }; + }; }; AD787ADC20D4611100C4712A = { CreatedOnToolsVersion = 9.4.1; @@ -1319,6 +1326,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_CXX_LANGUAGE_STANDARD = "c++14"; CLANG_ENABLE_MODULES = NO; + CODE_SIGN_ENTITLEMENTS = "PanoPainter-OSX/PanoPainter.entitlements"; CODE_SIGN_IDENTITY = "Mac Developer"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; @@ -1342,6 +1350,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_CXX_LANGUAGE_STANDARD = "c++14"; CLANG_ENABLE_MODULES = NO; + CODE_SIGN_ENTITLEMENTS = "PanoPainter-OSX/PanoPainter.entitlements"; CODE_SIGN_IDENTITY = "Mac Developer"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; diff --git a/src/app.cpp b/src/app.cpp index 62004c0..806badc 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -108,8 +108,20 @@ void App::initAssets() void App::initLog() { -#if defined(__IOS__) || defined(__OSX__) +#if defined(__IOS__) NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); + NSString* docpath = (NSString*)[paths objectAtIndex:0]; + data_path = [docpath cStringUsingEncoding:NSASCIIStringEncoding]; + + NSString* recpath = [docpath stringByAppendingString:@"/rec"]; + rec_path = [recpath cStringUsingEncoding:NSASCIIStringEncoding]; + NSError* recerr = nil; + if (![[NSFileManager defaultManager] createDirectoryAtPath:recpath withIntermediateDirectories:YES attributes:nil error:&recerr]) + { + LOG("error creating rec path: %s", [[recerr localizedDescription] cStringUsingEncoding:NSASCIIStringEncoding]); + } +#elif defined(__OSX__) + NSArray* paths = NSSearchPathForDirectoriesInDomains(NSPicturesDirectory, NSUserDomainMask, YES); NSString* docpath = [(NSString*)[paths objectAtIndex:0] stringByAppendingString:@"/PanoPainter"]; NSError* docerr = nil; @@ -126,7 +138,7 @@ void App::initLog() { LOG("error creating rec path: %s", [[recerr localizedDescription] cStringUsingEncoding:NSASCIIStringEncoding]); } -#elif _WIN32 +#elif defined(_WIN32) //CHAR my_documents[MAX_PATH]; //HRESULT result = SHGetFolderPathA(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, my_documents);