@@ -19,14 +19,12 @@ def __init__(self):
1919 self .logger .info ('Creating loader logger.' )
2020
2121 # Find the path to the application launch directory
22- # self.appdir = os.path.dirname(sys.argv[0])
23- # self.appdir = os.getcwd() # works
22+ # realpath expands to full path if __file__ or sys.argv[0] contains just a filename
2423 self .appdir = os .path .dirname (os .path .realpath (__file__ ))
24+ if self .appdir == "" :
25+ self .appdir = os .path .dirname (os .path .realpath (sys .argv [0 ]))
2526 self .logger .debug ("Application running from: %s" , self .appdir )
2627
27- # if not self.appdir:
28- # self.appdir = os.getcwd()
29-
3028 self .propeller_load_executables = {
3129 "Windows" : "/propeller-tools/windows/propeller-load.exe" ,
3230 "Linux" : "/propeller-tools/linux/propeller-load" ,
@@ -73,9 +71,11 @@ def load(self, action, file_to_load, com_port):
7371 self .loading = True
7472
7573 # Patch until we figure out why the __init__ is not getting called
76- if not self .appdir or self .appdir == '' :
77- # self.appdir = os. path.dirname( sys.argv[0])
74+ if not self .appdir or self .appdir == '' :
75+ # realpath expands to full path if __file__ or sys.argv[0] contains just a filename
7876 self .appdir = os .path .dirname (os .path .realpath (__file__ ))
77+ if self .appdir == "" :
78+ self .appdir = os .path .dirname (os .path .realpath (sys .argv [0 ]))
7979
8080 executable = self .appdir + self .propeller_load_executables [platform .system ()]
8181 self .logger .debug ('Loader executable path is: %s)' , executable )
0 commit comments