Config dir must exist before creating config file

This commit is contained in:
Ritiek Malhotra
2020-05-15 17:10:21 +05:30
parent 65c89075ac
commit 9c61d9951e
4 changed files with 15 additions and 19 deletions

View File

@@ -1,7 +1,5 @@
language: python
python:
- "3.4"
- "3.5"
- "3.6"
- "3.7"
- "3.8"

View File

@@ -64,8 +64,6 @@ setup(
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3 :: Only",

View File

@@ -2,5 +2,4 @@ from spotdl.command_line.__main__ import main
from spotdl.version import __version__
from spotdl.command_line.lib import Spotdl
from spotdl.track import Track

View File

@@ -54,8 +54,10 @@ def dump_config(config_file, config=DEFAULT_CONFIGURATION):
def get_config(config_file):
if os.path.isfile(config_file):
config = read_config(config_file)
else:
config = DEFAULT_CONFIGURATION
return config
config_dir = os.path.dirname(config_file)
os.makedirs(config_dir, exist_ok=True)
dump_config(config_file, config=DEFAULT_CONFIGURATION)
logger.info("Writing default configuration to {0}.".format(config_file))
@@ -69,6 +71,5 @@ def get_config(config_file):
"Please note that command line arguments have higher priority "
"than their equivalents in the configuration file."
)
return config
return DEFAULT_CONFIGURATION