Skip to content

Commit

Permalink
Fix iron_save_dialog for android and ios
Browse files Browse the repository at this point in the history
  • Loading branch information
luboslenco committed Jan 12, 2025
1 parent f1e58f5 commit 222e8f9
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions armorcore/sources/iron.h
Original file line number Diff line number Diff line change
Expand Up @@ -2455,14 +2455,8 @@ char_ptr_array_t *iron_open_dialog(char *filter_list, char *default_path, bool o

char *iron_save_dialog(char *filter_list, char *default_path) {
wchar_t *out_path = AndroidFileDialogSave();
size_t len = wcslen(out_path);
uint16_t *str = malloc(sizeof(uint16_t) * (len + 1));
for (int i = 0; i < len; i++) {
str[i] = out_path[i];
}
str[len] = 0;
// free(str);
return str;
wcstombs(temp_string, out_path, sizeof(temp_string));
return temp_string;
}

#elif defined(KINC_IOS)
Expand All @@ -2476,14 +2470,8 @@ char_ptr_array_t *iron_open_dialog(char *filter_list, char *default_path, bool o
char *iron_save_dialog(char *filter_list, char *default_path) {
// Path to app document directory
wchar_t *out_path = IOSFileDialogSave();
size_t len = wcslen(out_path);
uint16_t *str = malloc(sizeof(uint16_t) * (len + 1));
for (int i = 0; i < len; i++) {
str[i] = out_path[i];
}
str[len] = 0;
// free(str);
return str;;
wcstombs(temp_string, out_path, sizeof(temp_string));
return temp_string;
}
#endif

Expand Down

0 comments on commit 222e8f9

Please sign in to comment.