diff options
| author | 2022-01-02 09:17:31 +0200 | |
|---|---|---|
| committer | 2022-01-02 09:17:31 +0200 | |
| commit | 107e720198379cc68c2034d94ecf5f487213367a (patch) | |
| tree | c64f6c1918b193432decbd2a771f885f8d0defec /src/Config.zig | |
| parent | Make <untab> actually do something (diff) | |
| download | es-107e720198379cc68c2034d94ecf5f487213367a.tar.gz es-107e720198379cc68c2034d94ecf5f487213367a.tar.xz es-107e720198379cc68c2034d94ecf5f487213367a.zip | |
Get rid of a possible oopsie
Diffstat (limited to 'src/Config.zig')
| -rw-r--r-- | src/Config.zig | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Config.zig b/src/Config.zig index 2e6c388..e7afd76 100644 --- a/src/Config.zig +++ b/src/Config.zig | |||
| @@ -31,13 +31,13 @@ pub fn readConfig(allocator: Allocator) !Config { | |||
| 31 | 31 | ||
| 32 | if (env_map.get("XDG_CONFIG_HOME")) |base_dir| { | 32 | if (env_map.get("XDG_CONFIG_HOME")) |base_dir| { |
| 33 | try readConfigInBaseDir(allocator, &config, base_dir); | 33 | try readConfigInBaseDir(allocator, &config, base_dir); |
| 34 | } else { | 34 | } else if (env_map.get("HOME")) |home| { |
| 35 | // TODO: Maybe return an error instead of .? | ||
| 36 | const home = env_map.get("HOME").?; | ||
| 37 | const home_config = try std.fs.path.join(allocator, &.{ home, ".config" }); | 35 | const home_config = try std.fs.path.join(allocator, &.{ home, ".config" }); |
| 38 | defer allocator.free(home_config); | 36 | defer allocator.free(home_config); |
| 39 | 37 | ||
| 40 | try readConfigInBaseDir(allocator, &config, home_config); | 38 | try readConfigInBaseDir(allocator, &config, home_config); |
| 39 | } else { | ||
| 40 | std.log.err("No $HOME environment variable available!", .{}); | ||
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | return config; | 43 | return config; |