dabo Commit
Revision 4915
Date: 2009-01-08 04:44:19 -0800 (Thu, 08 Jan 2009)
Author: Ed
Trac: http://trac.dabodev.com/changeset/4915

Changed:
U   trunk/dabo/dApp.py

Log:
Fixed a bug that appeared when the main script was run as an executable. The 
old code expected:

python main.py

... but if you ran it as:

./main.py

... it would return '.' as the name of the app, instead of 'main'.


Diff:
Modified: trunk/dabo/dApp.py
===================================================================
--- trunk/dabo/dApp.py  2009-01-07 14:32:09 UTC (rev 4914)
+++ trunk/dabo/dApp.py  2009-01-08 12:44:19 UTC (rev 4915)
@@ -1324,7 +1324,10 @@
                try:
                        hd = self._homeDirectory
                except AttributeError:
-                       scriptDir = os.path.split(os.path.join(os.getcwd(), 
sys.argv[0]))[0]
+                       # Get the script name that launched the app. In case it 
was run
+                       # as an executable, strip the leading './'
+                       calledScript = sys.argv[0].lstrip("./")
+                       scriptDir = os.path.split(os.path.join(os.getcwd(), 
calledScript))[0]
                        appDir = 
os.path.split(inspect.getabsfile(self.__class__))[0]
 
                        def issubdir(d1, d2):




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to