forked from SaschaWillems/VulkanCapsViewer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathappleutils.mm
25 lines (20 loc) · 805 Bytes
/
appleutils.mm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#ifdef VK_USE_PLATFORM_IOS_MVK
// iOS Utility Functions
#import <UIKit/UIKit.h>
extern "C" void setWorkingFolderForiOS(void)
{
// On iOS, only the document directory for the app can be read/written from.
// This function just sets that as the current working folder.
NSArray *docPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *myPath = [docPath objectAtIndex:0];
chdir( [myPath UTF8String]);
}
extern "C" const char *getWorkingFolderForiOS(void)
{
static char cWorkingFolder[512];
NSArray *docPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *myPath = [docPath objectAtIndex:0];
strncpy(cWorkingFolder, [myPath UTF8String], 512);
return cWorkingFolder;
}
#endif