Bugfix missing path dir on autostart

This commit is contained in:
Rico Tiongson 2019-03-05 22:35:44 +08:00
parent 2ee59cf722
commit da9ddd9338
2 changed files with 6 additions and 1 deletions

View File

@ -6,7 +6,7 @@ python:
- 3.5 - 3.5
- 3.6 - 3.6
- 3.7 - 3.7
- 3.8 - 3.8-dev
addons: addons:
apt: apt:
update: true update: true

View File

@ -45,6 +45,11 @@ def get_status():
# sets the autostart status # sets the autostart status
def set_status(status=ON): def set_status(status=ON):
if status == ON: if status == ON:
# make sure dir exists
path = target_path()
path_dir = os.path.dirname(path)
if not os.path.exists(path_dir):
os.makedirs(path_dir)
with open(target_path(), 'w') as file: with open(target_path(), 'w') as file:
file.write(template()) file.write(template())
elif status == OFF: elif status == OFF: