This commit is contained in:
Jeroen van Rijn
2025-06-05 16:54:39 +02:00
parent 3412b13216
commit a1759aa2fa
2 changed files with 21 additions and 16 deletions
+18
View File
@@ -3,6 +3,24 @@ package os2
import "base:runtime"
@(require) import win32 "core:sys/windows"
@(require_results)
user_cache_dir :: proc(allocator: runtime.Allocator) -> (dir: string, err: Error) {
guid := win32.FOLDERID_LocalAppData
return _get_known_folder_path(&guid, allocator)
}
@(require_results)
user_config_dir :: proc(allocator: runtime.Allocator) -> (dir: string, err: Error) {
guid := win32.FOLDERID_RoamingAppData
return _get_known_folder_path(&guid, allocator)
}
@(require_results)
user_home_dir :: proc(allocator: runtime.Allocator) -> (dir: string, err: Error) {
guid := win32.FOLDERID_Profile
return _get_known_folder_path(&guid, allocator)
}
@(require_results)
_get_known_folder_path :: proc(rfid: win32.REFKNOWNFOLDERID, allocator: runtime.Allocator) -> (dir: string, err: Error) {
// https://learn.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetknownfolderpath