Implement iron_create_directory for ios
This commit is contained in:
@@ -5,3 +5,4 @@
|
||||
void IOSFileDialogOpen();
|
||||
wchar_t *IOSFileDialogSave();
|
||||
void IOSDeleteFile(const char *path);
|
||||
void IOSCreateDirectory(const char *path);
|
||||
|
||||
@@ -27,3 +27,9 @@ void IOSDeleteFile(const char *path) {
|
||||
NSString *nspath = [NSString stringWithUTF8String:path];
|
||||
[[NSFileManager defaultManager] removeItemAtPath:nspath error:&error];
|
||||
}
|
||||
|
||||
void IOSCreateDirectory(const char *path) {
|
||||
NSError *error = nil;
|
||||
NSString *nspath = [NSString stringWithUTF8String:path];
|
||||
[[NSFileManager defaultManager] createDirectoryAtPath:nspath withIntermediateDirectories:YES attributes:nil error:&error];
|
||||
}
|
||||
|
||||
@@ -1546,6 +1546,24 @@ char *iron_read_directory(char *path) {
|
||||
return files;
|
||||
}
|
||||
|
||||
void iron_create_directory(char *path) {
|
||||
#ifdef IRON_IOS
|
||||
IOSCreateDirectory(path);
|
||||
#elif defined(IRON_WINDOWS)
|
||||
char cmd[1024];
|
||||
strcpy(cmd, "mkdir \"");
|
||||
strcat(cmd, path);
|
||||
strcat(cmd, "\"");
|
||||
iron_sys_command(cmd);
|
||||
#else
|
||||
char cmd[1024];
|
||||
strcpy(cmd, "mkdir -p \"");
|
||||
strcat(cmd, path);
|
||||
strcat(cmd, "\"");
|
||||
iron_sys_command(cmd);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool iron_file_exists(char *path) {
|
||||
iron_file_reader_t reader;
|
||||
if (iron_file_reader_open(&reader, path, IRON_FILE_TYPE_ASSET)) {
|
||||
|
||||
@@ -21,10 +21,8 @@ let _file_download_bytes_map: map_t<string, file_download_bytes_data_t> = map_cr
|
||||
let _file_cache_cloud_map: map_t<string, file_cache_cloud_data_t> = map_create();
|
||||
|
||||
///if arm_windows
|
||||
let file_cmd_mkdir: string = "mkdir";
|
||||
let file_cmd_copy: string = "copy";
|
||||
///else
|
||||
let file_cmd_mkdir: string = "mkdir -p";
|
||||
let file_cmd_copy: string = "cp";
|
||||
///end
|
||||
|
||||
@@ -79,7 +77,7 @@ function file_read_directory(path: string): string[] {
|
||||
}
|
||||
|
||||
function file_create_directory(path: string) {
|
||||
iron_sys_command(file_cmd_mkdir + " \"" + path + "\"");
|
||||
iron_create_directory(path);
|
||||
}
|
||||
|
||||
function file_copy(src_path: string, dst_path: string) {
|
||||
|
||||
@@ -336,6 +336,7 @@ declare function iron_delay_idle_sleep(): void;
|
||||
declare function iron_open_dialog(filter_list: string, default_path: string, open_multiple: bool): string[];
|
||||
declare function iron_save_dialog(filter_list: string, default_path: string): string;
|
||||
declare function iron_read_directory(path: string): string;
|
||||
declare function iron_create_directory(path: string): void;
|
||||
declare function iron_file_exists(path: string): bool;
|
||||
declare function iron_delete_file(path: string): void;
|
||||
declare function iron_inflate(bytes: buffer_t, raw: bool): buffer_t;
|
||||
|
||||
Reference in New Issue
Block a user