From 985657987f5479f2032ae89871b27596a46e896b Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Wed, 24 Nov 2021 14:44:37 -0300 Subject: [PATCH] [web.controller] refactoring: autorstart dir creation --- bauh/gems/web/controller.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bauh/gems/web/controller.py b/bauh/gems/web/controller.py index 02fdb01a..df568865 100644 --- a/bauh/gems/web/controller.py +++ b/bauh/gems/web/controller.py @@ -26,7 +26,7 @@ from bauh.api.abstract.model import SoftwarePackage, CustomSoftwareAction, Packa SuggestionPriority, PackageStatus from bauh.api.abstract.view import MessageType, MultipleSelectComponent, InputOption, SingleSelectComponent, \ SelectViewType, TextInputComponent, FormComponent, FileChooserComponent, ViewComponent, PanelComponent -from bauh.api.paths import DESKTOP_ENTRIES_DIR, AUTOSTART_DIR +from bauh.api.paths import DESKTOP_ENTRIES_DIR from bauh.commons import resource from bauh.commons.boot import CreateConfigFile from bauh.commons.html import bold @@ -762,10 +762,12 @@ class WebApplicationManager(SoftwareManager): pkg.desktop_entry = desktop_entry_path - if '--tray=start-in-tray' in install_options: - Path(AUTOSTART_DIR).mkdir(parents=True, exist_ok=True) + autostart_file = pkg.get_autostart_path() - with open(pkg.get_autostart_path(), 'w+') as f: + if autostart_file and '--tray=start-in-tray' in install_options: + Path(os.path.dirname(autostart_file)).mkdir(parents=True, exist_ok=True) + + with open(autostart_file, 'w+') as f: f.write(entry_content) self.logger.info(f"Autostart file created '{autostart_file}'")