diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2025-10-28 13:21:35 +0000 |
|---|---|---|
| committer | gingerBill <gingerBill@users.noreply.github.com> | 2025-10-28 13:21:35 +0000 |
| commit | 5e528f8e97eb9767f1fb87f09d1aca9063228bd5 (patch) | |
| tree | 754697df824238eb552d76ab3d984176d298a06b | |
| parent | 4c8f99cd36ec05dca1b03a5935b92685549b5717 (diff) | |
Remove `core:encoding/ini` dependency in `user_posix.odin`
| -rw-r--r-- | core/os/os2/user_posix.odin | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/core/os/os2/user_posix.odin b/core/os/os2/user_posix.odin index 691745b7a..09134d847 100644 --- a/core/os/os2/user_posix.odin +++ b/core/os/os2/user_posix.odin @@ -2,7 +2,6 @@ package os2 import "base:runtime" -import "core:encoding/ini" import "core:strings" _user_cache_dir :: proc(allocator: runtime.Allocator) -> (dir: string, err: Error) { @@ -157,18 +156,19 @@ _xdg_user_dirs_lookup :: proc(xdg_key: string, allocator: runtime.Allocator) -> user_dirs_path := concatenate({config_dir, "/user-dirs.dirs"}, temp_allocator) or_return content := read_entire_file(user_dirs_path, temp_allocator) or_return - it := ini.Iterator{ - section = "", - _src = string(content), - options = ini.Options{ - comment = "#", - key_lower_case = false, - }, - } + xdg_dirs := string(content) + for line in strings.split_lines_iterator(&xdg_dirs) { + if len(line) > 0 && line[0] == '#' { + continue + } - for k, v in ini.iterate(&it) { - if k == xdg_key { - return replace_environment_placeholders(v, allocator), nil + equals := strings.index(line, "=") + if equals > -1 { + if line[:equals] == xdg_key { + // Unquote to return a bare path string as we do on Windows + val := strings.trim(line[equals+1:], "\"") + return replace_environment_placeholders(val, allocator), nil + } } } return |