array
This commit is contained in:
@@ -363,4 +363,33 @@ fn i32 os_thread_join(os_thread_t *thread) {
|
||||
// os_thread_join(&threads[i]);
|
||||
// }
|
||||
// ma_end_scratch(scratch);
|
||||
// }
|
||||
// }
|
||||
|
||||
fn s8_t os_appdata(ma_arena_t *arena, s8_t name) {
|
||||
assert(name.len != 0);
|
||||
assert(name.str);
|
||||
assert(arena);
|
||||
|
||||
wchar_t *out_path = NULL;
|
||||
HRESULT hr = SHGetKnownFolderPath(&FOLDERID_RoamingAppData, KF_FLAG_CREATE, NULL, &out_path);
|
||||
if (!SUCCEEDED(hr)) {
|
||||
debugf(__FUNCTION__".SHGetKnownFolderPath failed with hr: %d", hr);
|
||||
return s8_null;
|
||||
}
|
||||
|
||||
s16_t appdata_path = s16_from_str16((u16 *)out_path);
|
||||
|
||||
ma_temp_t scratch = ma_begin_scratch1(arena);
|
||||
s8_t tmp = s8_from_s16(scratch.arena, appdata_path);
|
||||
s8_normalize_path_unsafe(tmp);
|
||||
s8_t path = s8_printf(arena, "%S/%S/", tmp, name);
|
||||
os_mkdir_t mkdir_status = os_mkdir(path);
|
||||
if (mkdir_status != os_mkdir_success && mkdir_status != os_mkdir_file_exists) {
|
||||
debugf(__FUNCTION__".os_mkdir failed with status: %d, for: %S", mkdir_status, path);
|
||||
path = s8_null;
|
||||
}
|
||||
|
||||
CoTaskMemFree(out_path);
|
||||
ma_end_scratch(scratch);
|
||||
return path;
|
||||
}
|
||||
Reference in New Issue
Block a user