summaryrefslogtreecommitdiff
path: root/src/leap/bitmask
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2014-07-25 12:48:29 -0300
committerTomás Touceda <chiiph@leap.se>2014-07-25 12:48:29 -0300
commitddb9145c2f5f0ea72ca3520de19e1681154f9e07 (patch)
tree4753e06a3180ffb6197527d074c9a3d6c3ab3def /src/leap/bitmask
parented93cbe97f7898d0759e63f9917f7d001a2e9b78 (diff)
parentc4df5cff32524bf2fa9e5d43f08210361531d273 (diff)
Merge remote-tracking branch 'refs/remotes/ivan/bug/create-autostart-path' into develop
Diffstat (limited to 'src/leap/bitmask')
-rw-r--r--src/leap/bitmask/util/autostart.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/leap/bitmask/util/autostart.py b/src/leap/bitmask/util/autostart.py
index 5f003bd8..d7a8afb8 100644
--- a/src/leap/bitmask/util/autostart.py
+++ b/src/leap/bitmask/util/autostart.py
@@ -22,6 +22,7 @@ import os
from leap.bitmask.config import flags
from leap.bitmask.platform_init import IS_LINUX
+from leap.common.files import mkdir_p
logger = logging.getLogger(__name__)
@@ -38,7 +39,8 @@ Terminal=false
Icon=bitmask
"""
-DESKTOP_ENTRY_PATH = os.path.expanduser("~/.config/autostart/bitmask.desktop")
+DESKTOP_ENTRY_PATH = os.path.expanduser("~/.config/autostart/")
+DESKTOP_ENTRY_FILE = os.path.join(DESKTOP_ENTRY_PATH, 'bitmask.desktop')
def set_autostart(enabled):
@@ -56,11 +58,12 @@ def set_autostart(enabled):
return
if enabled:
- with open(DESKTOP_ENTRY_PATH, 'w') as f:
+ mkdir_p(DESKTOP_ENTRY_PATH)
+ with open(DESKTOP_ENTRY_FILE, 'w') as f:
f.write(DESKTOP_ENTRY)
else:
try:
- os.remove(DESKTOP_ENTRY_PATH)
+ os.remove(DESKTOP_ENTRY_FILE)
except OSError: # if the file does not exist
pass
except Exception as e: