diff options
Diffstat (limited to 'gmm_lib.py')
-rw-r--r-- | gmm_lib.py | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -7,8 +7,11 @@ import argparse, sys, os, psutil, subprocess, json, configparser # LOW-LEVEL values +appname_full = "Graphical Mount Manager" appname = "gmm" appversion = "0.0.1" +authors = ["bgstack15"] +icon_name = "dvd_unmount" conffile = os.path.join(os.getenv("HOME"),".config",appname,"config") ABOUT_TEXT = """ @@ -211,6 +214,13 @@ class Gmm(): if debuglev(1): ferror(f"Loading config file {configfile}") self.config.read(configfile) + if (not self.config) or self.config == configparser.ConfigParser(): + ferror(f"Generating new config file, {configfile}!") + # This is setting a new config file. + self.config[appname] = { + "mounts_dir": os.path.expanduser("~/mnt") + } + self.save_config(configfile) try: #config["gmm"]["mounts_dir"] = os.path.expanduser(config["gmm"]["mounts_dir"]) self.config.set(appname,"mounts_dir", os.path.expanduser(self.config[appname]["mounts_dir"].strip('"'))) @@ -229,7 +239,7 @@ class Gmm(): md = md.replace(os.path.expanduser("~"),"~") self.config.set(appname,"mounts_dir",md) with open(configfile,"w") as cf: - config.write(cf) + self.config.write(cf) def cli_main(self): # default behavior is to show the gui, unless --no-gui, or given some paths to mount, or --list |