create data directory first before selection file

cc #645
This commit is contained in:
Gokcehan committed 2021-06-12 23:29:54 +03:00
1 parent eaaf08e425
commit 4220868cc7
1 file changed
+4
+4
View File
@@ -137,6 +137,10 @@ func loadFiles() (list []string, cp bool, err error) {
}
func saveFiles(list []string, cp bool) error {
if err := os.MkdirAll(filepath.Dir(gFilesPath), os.ModePerm); err != nil {
return fmt.Errorf("creating data directory: %s", err)
}
files, err := os.Create(gFilesPath)
if err != nil {
return fmt.Errorf("opening file selections file: %s", err)