diff options
| author | 2024-07-10 09:59:10 +0300 | |
|---|---|---|
| committer | 2024-07-10 09:59:10 +0300 | |
| commit | 087b84f558d68e307f09410442908a5f4fd7fa49 (patch) | |
| tree | ae339b2258a2f60eff572ca09faa1705df3d7451 /xdg.zig | |
| parent | Update for latest zig (diff) | |
| download | zig-xdg-087b84f558d68e307f09410442908a5f4fd7fa49.tar.gz zig-xdg-087b84f558d68e307f09410442908a5f4fd7fa49.tar.xz zig-xdg-087b84f558d68e307f09410442908a5f4fd7fa49.zip | |
Update for zig 0.12.00.3.0
Diffstat (limited to 'xdg.zig')
| -rw-r--r-- | xdg.zig | 12 |
1 files changed, 6 insertions, 6 deletions
| @@ -5,11 +5,11 @@ const ArrayList = std.ArrayList; | |||
| 5 | const Dir = std.fs.Dir; | 5 | const Dir = std.fs.Dir; |
| 6 | 6 | ||
| 7 | pub fn getDataHome(allocator: Allocator, app_name: []const u8) ![]u8 { | 7 | pub fn getDataHome(allocator: Allocator, app_name: []const u8) ![]u8 { |
| 8 | if (std.os.getenv("XDG_DATA_HOME")) |data_home| { | 8 | if (std.posix.getenv("XDG_DATA_HOME")) |data_home| { |
| 9 | return std.fs.path.join(allocator, &.{ data_home, app_name }); | 9 | return std.fs.path.join(allocator, &.{ data_home, app_name }); |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | if (std.os.getenv("HOME")) |home| { | 12 | if (std.posix.getenv("HOME")) |home| { |
| 13 | return std.fs.path.join(allocator, &.{ home, ".local", "share", app_name }); | 13 | return std.fs.path.join(allocator, &.{ home, ".local", "share", app_name }); |
| 14 | } | 14 | } |
| 15 | 15 | ||
| @@ -17,11 +17,11 @@ pub fn getDataHome(allocator: Allocator, app_name: []const u8) ![]u8 { | |||
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | pub fn getConfigHome(allocator: Allocator, app_name: []const u8) ![]u8 { | 19 | pub fn getConfigHome(allocator: Allocator, app_name: []const u8) ![]u8 { |
| 20 | if (std.os.getenv("XDG_CONFIG_HOME")) |config_home| { | 20 | if (std.posix.getenv("XDG_CONFIG_HOME")) |config_home| { |
| 21 | return std.fs.path.join(allocator, &.{ config_home, app_name }); | 21 | return std.fs.path.join(allocator, &.{ config_home, app_name }); |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | if (std.os.getenv("HOME")) |home| { | 24 | if (std.posix.getenv("HOME")) |home| { |
| 25 | return std.fs.path.join(allocator, &.{ home, ".config", app_name }); | 25 | return std.fs.path.join(allocator, &.{ home, ".config", app_name }); |
| 26 | } | 26 | } |
| 27 | 27 | ||
| @@ -29,7 +29,7 @@ pub fn getConfigHome(allocator: Allocator, app_name: []const u8) ![]u8 { | |||
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | pub fn getBinHome(allocator: Allocator) ![]u8 { | 31 | pub fn getBinHome(allocator: Allocator) ![]u8 { |
| 32 | if (std.os.getenv("HOME")) |home| { | 32 | if (std.posix.getenv("HOME")) |home| { |
| 33 | return std.fs.path.join(allocator, &.{ home, ".local", "bin" }); | 33 | return std.fs.path.join(allocator, &.{ home, ".local", "bin" }); |
| 34 | } | 34 | } |
| 35 | 35 | ||
| @@ -41,7 +41,7 @@ pub fn getConfigDirs(allocator: Allocator, app_name: []const u8) ![][]u8 { | |||
| 41 | errdefer for (list.items) |s| allocator.free(s); | 41 | errdefer for (list.items) |s| allocator.free(s); |
| 42 | defer list.deinit(); | 42 | defer list.deinit(); |
| 43 | 43 | ||
| 44 | if (std.os.getenv("XDG_CONFIG_DIRS")) |config_dirs| { | 44 | if (std.posix.getenv("XDG_CONFIG_DIRS")) |config_dirs| { |
| 45 | var it = std.mem.split(u8, config_dirs, ":"); | 45 | var it = std.mem.split(u8, config_dirs, ":"); |
| 46 | while (it.next()) |config_dir| { | 46 | while (it.next()) |config_dir| { |
| 47 | try list.append(try std.fs.path.join(allocator, &.{ config_dir, app_name })); | 47 | try list.append(try std.fs.path.join(allocator, &.{ config_dir, app_name })); |