summaryrefslogtreecommitdiff
path: root/xdg.zig
diff options
context:
space:
mode:
Diffstat (limited to 'xdg.zig')
-rw-r--r--xdg.zig12
1 files changed, 6 insertions, 6 deletions
diff --git a/xdg.zig b/xdg.zig
index 28d9059..c56ce38 100644
--- a/xdg.zig
+++ b/xdg.zig
@@ -5,11 +5,11 @@ const ArrayList = std.ArrayList;
5const Dir = std.fs.Dir; 5const Dir = std.fs.Dir;
6 6
7pub fn getDataHome(allocator: Allocator, app_name: []const u8) ![]u8 { 7pub 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
19pub fn getConfigHome(allocator: Allocator, app_name: []const u8) ![]u8 { 19pub 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
31pub fn getBinHome(allocator: Allocator) ![]u8 { 31pub 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 }));