Skip to content
This repository has been archived by the owner on Nov 10, 2022. It is now read-only.

Commit

Permalink
fix: create the systemd folder if it doesn't already exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Zweili committed Feb 23, 2019
1 parent d3b94ac commit 276d12a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions borg_qt/systemd.py
Expand Up @@ -6,14 +6,19 @@
class SystemdFile():
def __init__(self, file_name):
self.file_name = file_name
self.path = os.path.join(os.environ['HOME'],
'.config/systemd/user/',
self.systemd_folder = os.path.join(os.environ['HOME'],
'.config/systemd/user/')
self.path = os.path.join(self.systemd_folder,
self.file_name)
self.content = configparser.ConfigParser()
self.content.optionxform = str
self.content['Unit'] = {}

def write(self):
try:
os.makedirs(self.systemd_folder)
except OSError:
pass
with open(self.path, 'w+') as configfile:
self.content.write(configfile)

Expand Down

0 comments on commit 276d12a

Please sign in to comment.