Merge pull request #2 from altf4/missing_path

Missing path
This commit is contained in:
Will Bradley 2014-01-08 02:00:49 -08:00
commit 70f7357a3a

View File

@ -52,6 +52,7 @@ startup_active_label = "✓ Start Automatically"
startup_inactive_label = "Start Automatically" startup_inactive_label = "Start Automatically"
home_path = os.path.expanduser("~") home_path = os.path.expanduser("~")
startup_path = home_path+'/.config/autostart/pinger.desktop' startup_path = home_path+'/.config/autostart/pinger.desktop'
startup_dir = home_path+'/.config/autostart/'
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("-t", "--target", help="Target to PING against. (IP / Hostname / Domain name). Defaults to 4.2.2.2") parser.add_argument("-t", "--target", help="Target to PING against. (IP / Hostname / Domain name). Defaults to 4.2.2.2")
@ -60,7 +61,7 @@ parser.add_argument("-m", "--maxlog", help="Maximum amount of pings to log. Defa
args = parser.parse_args() args = parser.parse_args()
#accumulate the arguments for use later #accumulate the arguments for use later
arguments = "" arguments = " "
for arg in sys.argv[1:]: for arg in sys.argv[1:]:
arguments += arg + " " arguments += arg + " "
@ -135,6 +136,8 @@ class Pinger:
Gtk.main_quit() Gtk.main_quit()
def create_autostart(self, widget, data=None): 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: with open(startup_path,'w') as f:
f.write("[Desktop Entry]\r\n" f.write("[Desktop Entry]\r\n"
"Type=Application\r\n" "Type=Application\r\n"