@@ -18,12 +18,13 @@ def __init__(self):
1818 self .logger = logging .getLogger ('blockly.loader' )
1919 self .logger .info ('Creating loader logger.' )
2020
21- # Find the path to the application launch directory
21+ # Find the path from which application was launched
2222 # realpath expands to full path if __file__ or sys.argv[0] contains just a filename
2323 self .appdir = os .path .dirname (os .path .realpath (__file__ ))
24- if self .appdir == "" :
24+ if self .appdir == "" or self .appdir == "/" :
25+ # launch path is blank; try extracting from argv
2526 self .appdir = os .path .dirname (os .path .realpath (sys .argv [0 ]))
26- self .logger .debug ("Application running from: %s" , self .appdir )
27+ self .logger .debug ("PropellerLoad.py: Application running from: %s" , self .appdir )
2728
2829 self .propeller_load_executables = {
2930 "Windows" : "/propeller-tools/windows/propeller-load.exe" ,
@@ -72,9 +73,10 @@ def load(self, action, file_to_load, com_port):
7273
7374 # Patch until we figure out why the __init__ is not getting called
7475 if not self .appdir or self .appdir == '' :
75- # realpath expands to full path if __file__ or sys.argv[0] contains just a filename
76+ # realpath expands to full path if __file__ or sys.argv[0] contains just a filename
7677 self .appdir = os .path .dirname (os .path .realpath (__file__ ))
77- if self .appdir == "" :
78+ if self .appdir == "" or self .appdir == "/" :
79+ # launch path is blank; try extracting from argv
7880 self .appdir = os .path .dirname (os .path .realpath (sys .argv [0 ]))
7981
8082 executable = self .appdir + self .propeller_load_executables [platform .system ()]
0 commit comments