diff --git a/gui/Gui/Icon.py b/gui/Gui/Icon.py index 60919e2..036e145 100644 --- a/gui/Gui/Icon.py +++ b/gui/Gui/Icon.py @@ -35,7 +35,12 @@ import Misc def ScytherIcon(window): """ Set a nice Scyther icon """ - basedir = os.path.abspath(os.path.dirname(sys.argv[0])) + import os,inspect + + # Determine base directory (taking symbolic links into account) + cmd_file = os.path.realpath(os.path.abspath(inspect.getfile( inspect.currentframe() ))) + basedir = os.path.split(cmd_file)[0] + path = os.path.join(basedir,"Images") iconfile = Misc.mypath(os.path.join(path,"scyther-gui-32.ico")) if os.path.isfile(iconfile): diff --git a/gui/Gui/Misc.py b/gui/Gui/Misc.py index b60d8e9..ba2bc5b 100644 --- a/gui/Gui/Misc.py +++ b/gui/Gui/Misc.py @@ -60,7 +60,11 @@ def sorted(li): def mypath(file): """ Construct a file path relative to the scyther-gui main directory """ - basedir = os.path.dirname(__file__) + import os, inspect + + # Determine base directory (taking symbolic links into account) + cmd_file = os.path.realpath(os.path.abspath(inspect.getfile( inspect.currentframe() ))) + basedir = os.path.split(cmd_file)[0] return os.path.join(basedir,file) # commands: push data in, get fp.write out diff --git a/gui/Scyther/Misc.py b/gui/Scyther/Misc.py index cf37b0b..503dfc2 100644 --- a/gui/Scyther/Misc.py +++ b/gui/Scyther/Misc.py @@ -84,7 +84,9 @@ def ensurePath(pt): def mypath(file): """ Construct a file path relative to the scyther-gui main directory """ - basedir = os.path.dirname(__file__) + # Determine base directory (taking symbolic links into account) + cmd_file = os.path.realpath(os.path.abspath(inspect.getfile( inspect.currentframe() ))) + basedir = os.path.split(cmd_file)[0] return os.path.join(basedir,file) def getShell(): diff --git a/gui/scyther-gui.py b/gui/scyther-gui.py index 1a6a0c7..ff7577a 100755 --- a/gui/scyther-gui.py +++ b/gui/scyther-gui.py @@ -179,11 +179,15 @@ def isSplashNeeded(opts): class ScytherApp(wx.App): def OnInit(self): + import os, inspect wx.GetApp().SetAppName("Scyther-gui") + # Determine base directory (taking symbolic links into account) + cmd_file = os.path.realpath(os.path.abspath(inspect.getfile( inspect.currentframe() ))) + basedir = os.path.split(cmd_file)[0] + # Parse arguments - basedir = os.path.abspath(os.path.dirname(sys.argv[0])) (opts,args) = parseArgs() # License option may abort here