From e5c7d9016dbebb9646adac01a9bf583973125630 Mon Sep 17 00:00:00 2001 From: trivernis Date: Sat, 17 Jun 2023 13:13:22 +0200 Subject: [PATCH] Fix issue with config script when home path doesn't exist --- lib/config.nu | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/config.nu b/lib/config.nu index a571608..053d342 100644 --- a/lib/config.nu +++ b/lib/config.nu @@ -5,7 +5,12 @@ export def read_file [app: string, filename = "config.toml"] { # returns the path to an apps config dir export def get_path [app: string] { - let local = ( $env.HOME | path join ".config" | path join $app ) + let home = $env.HOME? + + if $home == null { + "/etc" | path join $app + } + let local = ( $home | path join ".config" | path join $app ) if ( $local | path exists ) { $local