Archived
1
Fork 0
This repository has been archived on 2025-04-12. You can view files and clone it, but cannot push or open issues or pull requests.
prism/platforms/uikit/file.mm

28 lines
846 B
Text
Raw Normal View History

2020-08-11 12:07:21 -04:00
#include "file.hpp"
#import <Foundation/Foundation.h>
#include <array>
#import <UIKit/UIKit.h>
#include "string_utils.hpp"
#include "log.hpp"
2022-02-12 20:24:54 -05:00
void prism::set_domain_path(const prism::domain domain, const prism::path& path) {
2020-08-11 12:07:21 -04:00
NSBundle* bundle = [NSBundle mainBundle];
NSString* resourceFolderPath = [bundle resourcePath];
std::string s = std::string(path);
s = replace_substring(s, "{resource_dir}", std::string([resourceFolderPath cStringUsingEncoding:NSUTF8StringEncoding]));
domain_data[(int)domain] = s;
}
2022-02-12 20:24:54 -05:00
prism::path prism::get_writeable_directory() {
2020-08-11 12:07:21 -04:00
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString* resourceFolderPath = paths[0];
2022-02-12 20:24:54 -05:00
return std::string([resourceFolderPath cStringUsingEncoding:NSUTF8StringEncoding]);
2020-08-11 12:07:21 -04:00
}