From f09333305b4b499f29cd1355fffedd1304464b20 Mon Sep 17 00:00:00 2001 From: AltF4 Date: Sat, 4 Jan 2014 20:13:51 -0700 Subject: [PATCH] Fix bug where .desktop file can't be made due to missing autostart directory Added a check for ~/.config/autostart/ If if doesn't exist, make it. --- pinger.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pinger.py b/pinger.py index a7d9ff7..f328834 100755 --- a/pinger.py +++ b/pinger.py @@ -52,6 +52,7 @@ startup_active_label = "✓ Start Automatically" startup_inactive_label = "Start Automatically" home_path = os.path.expanduser("~") startup_path = home_path+'/.config/autostart/pinger.desktop' +startup_dir = home_path+'/.config/autostart/' parser = argparse.ArgumentParser() parser.add_argument("-t", "--target", help="Target to PING against. (IP / Hostname / Domain name). Defaults to 4.2.2.2") @@ -135,6 +136,8 @@ class Pinger: Gtk.main_quit() def create_autostart(self, widget, data=None): + if not os.path.exists(startup_dir): + os.makedirs(startup_dir) with open(startup_path,'w') as f: f.write("[Desktop Entry]\r\n" "Type=Application\r\n"