Don't mkdir defaultConfigDirectory if not needed
Check to see if config.json exists in the current working directory before creating a new configuration directory in the home folder. If config.json exists, then defaultConfigDirectory would be empty and unused - so there's no reason to create that directory if it's not going to be used.
This commit is contained in:
parent
79078d8e0b
commit
39e31794db
|
@ -256,13 +256,12 @@ def printLogo():
|
|||
)
|
||||
|
||||
def main():
|
||||
|
||||
if not Path(GLOBAL.defaultConfigDirectory).is_dir():
|
||||
os.makedirs(GLOBAL.defaultConfigDirectory)
|
||||
|
||||
|
||||
if Path("config.json").exists():
|
||||
GLOBAL.configDirectory = Path("config.json")
|
||||
else:
|
||||
if not Path(GLOBAL.defaultConfigDirectory).is_dir():
|
||||
os.makedirs(GLOBAL.defaultConfigDirectory)
|
||||
GLOBAL.configDirectory = GLOBAL.defaultConfigDirectory / "config.json"
|
||||
try:
|
||||
GLOBAL.config = Config(GLOBAL.configDirectory).generate()
|
||||
|
@ -362,4 +361,4 @@ if __name__ == "__main__":
|
|||
print(GLOBAL.log_stream.getvalue())
|
||||
|
||||
if not GLOBAL.arguments.quit: input("\nPress enter to quit\n")
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue