summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-10-11 08:51:26 +1100
committerJesse Duffield <jessedduffield@gmail.com>2020-10-12 08:48:28 +1100
commit1e79ab78dd93c0cd12796c0333fc2455546408ad (patch)
tree3f860f1024bea695e98d968894b888a69ae34cfd
parent1e48afeb8ff3be631155201c93ae6d909a9cebc2 (diff)
return default config when dealing with read only filesystem rather than create new config file
-rw-r--r--pkg/config/app_config.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/pkg/config/app_config.go b/pkg/config/app_config.go
index df4707a94..b4671e047 100644
--- a/pkg/config/app_config.go
+++ b/pkg/config/app_config.go
@@ -4,6 +4,7 @@ import (
"io/ioutil"
"os"
"path/filepath"
+ "strings"
"github.com/OpenPeeDeeP/xdg"
yaml "github.com/jesseduffield/yaml"
@@ -114,6 +115,9 @@ func loadUserConfig(configDir string, base *UserConfig) (*UserConfig, error) {
if os.IsNotExist(err) {
file, err := os.Create(fileName)
if err != nil {
+ if strings.Contains(err.Error(), "read-only file system") {
+ return base, nil
+ }
return nil, err
}
file.Close()