Create config file if it doesn't exist

This commit is contained in:
planet36 2020-10-11 23:28:04 -04:00
parent 610580b704
commit 2d7f9133b0
1 changed files with 4 additions and 0 deletions

View File

@ -719,7 +719,11 @@ class ConfigBase(Borg):
config_dir = get_config_dir()
if not os.path.isdir(config_dir):
os.makedirs(config_dir)
try:
if not os.path.isfile(self.command_line_options.config):
open(self.command_line_options.config, 'a').close()
backup_file = self.command_line_options.config + '~'
shutil.copy2(self.command_line_options.config, backup_file)