@@ -18,12 +18,13 @@ def __init__(self):
18
18
self .logger = logging .getLogger ('blockly.loader' )
19
19
self .logger .info ('Creating loader logger.' )
20
20
21
- # Find the path to the application launch directory
21
+ # Find the path from which application was launched
22
22
# realpath expands to full path if __file__ or sys.argv[0] contains just a filename
23
23
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
25
26
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 )
27
28
28
29
self .propeller_load_executables = {
29
30
"Windows" : "/propeller-tools/windows/propeller-load.exe" ,
@@ -72,9 +73,10 @@ def load(self, action, file_to_load, com_port):
72
73
73
74
# Patch until we figure out why the __init__ is not getting called
74
75
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
76
77
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
78
80
self .appdir = os .path .dirname (os .path .realpath (sys .argv [0 ]))
79
81
80
82
executable = self .appdir + self .propeller_load_executables [platform .system ()]
0 commit comments