Skip to content

Commit

Permalink
- add os cache dir for ios
Browse files Browse the repository at this point in the history
  • Loading branch information
polymonster committed Dec 22, 2023
1 parent f2c58d7 commit e9f7f4a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions core/pen/include/os.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ namespace pen
const Str os_path_for_resource(const c8* filename);
const user_info& os_get_user_info();
Str os_get_persistent_data_directory();
Str os_get_cache_data_directory();
void os_create_directory(const Str& dir);
void os_open_url(const Str& url);
void os_ignore_slient();
Expand Down
8 changes: 8 additions & 0 deletions core/pen/source/ios/os.mm
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,14 @@ Str os_get_persistent_data_directory()
}
}

Str os_get_cache_data_directory()
{
@autoreleasepool {
NSString* dir = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0];
return dir.UTF8String;
}
}

void os_create_directory(const Str& dir)
{
@autoreleasepool {
Expand Down

0 comments on commit e9f7f4a

Please sign in to comment.