| ... | @@ -45,6 +45,10 @@ pub fn getAppDataDir(allocator: mem.Allocator, appname: []const u8) GetAppDataDi | ... | @@ -45,6 +45,10 @@ pub fn getAppDataDir(allocator: mem.Allocator, appname: []const u8) GetAppDataDi |
| 45 | return fs.path.join(allocator, &[_][]const u8{ home_dir, "Library", "Application Support", appname }); | 45 | return fs.path.join(allocator, &[_][]const u8{ home_dir, "Library", "Application Support", appname }); |
| 46 | }, | 46 | }, |
| 47 | .linux, .freebsd, .netbsd, .dragonfly, .openbsd, .solaris => { | 47 | .linux, .freebsd, .netbsd, .dragonfly, .openbsd, .solaris => { |
| | 48 | if (os.getenv("XDG_DATA_HOME")) |xdg| { |
| | 49 | return fs.path.join(allocator, &[_][]const u8{ xdg, appname }); |
| | 50 | } |
| | 51 | |
| 48 | const home_dir = os.getenv("HOME") orelse { | 52 | const home_dir = os.getenv("HOME") orelse { |
| 49 | // TODO look in /etc/passwd | 53 | // TODO look in /etc/passwd |
| 50 | return error.AppDataDirUnavailable; | 54 | return error.AppDataDirUnavailable; |