- Improved binary locator.

This commit is contained in:
ccremers 2006-08-09 09:26:15 +00:00
parent b180735f78
commit 2cd1178905
3 changed files with 24 additions and 4 deletions

View File

@ -13,8 +13,9 @@
match match
maxruns maxruns
scyther
scytheroptions scytheroptions
bindir where the scyther executables reside
splashscreen 0/1
""" """
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------

View File

@ -19,19 +19,32 @@ from Misc import *
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
""" Globals """
bindir="."
#---------------------------------------------------------------------------
def init(dir):
global bindir
bindir = dir
#---------------------------------------------------------------------------
class Scyther(object): class Scyther(object):
def __init__ ( self): def __init__ ( self):
global bindir
# Where is my executable? # Where is my executable?
if sys.platform.startswith('win'): if sys.platform.startswith('win'):
""" Windows """ """ Windows """
# TODO hardcoded for now, bad # TODO hardcoded for now, bad
self.program = "Scyther.exe" self.program = os.path.join(bindir,"Scyther.exe")
if not os.path.isfile(self.program): if not os.path.isfile(self.program):
print "I can't find the Scyther executable at %s" % (self.program) print "I can't find the Scyther executable at %s" % (self.program)
else: else:
""" Non-windows """ """ Non-windows (linux) """
self.program = "scyther" self.program = os.path.join(bindir,"scyther")
# Init # Init
self.spdl = None self.spdl = None

View File

@ -14,6 +14,7 @@ from optparse import OptionParser, SUPPRESS_HELP
import Gui.Preference as Preference import Gui.Preference as Preference
import Gui.Mainwindow as Mainwindow import Gui.Mainwindow as Mainwindow
import Gui.Misc as Misc import Gui.Misc as Misc
import Scyther.Scyther as Scyther
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@ -75,11 +76,16 @@ class ScytherApp(wx.App):
wx.GetApp().SetAppName("Scyther-gui") wx.GetApp().SetAppName("Scyther-gui")
# Parse arguments # Parse arguments
basedir = os.path.abspath(os.path.dirname(sys.argv[0]))
(opts,args) = parseArgs() (opts,args) = parseArgs()
# Load preferences file # Load preferences file
Preference.init() Preference.init()
# Init Scyther libs
bindir = Preference.get("bindir",os.path.join(basedir,"Scyther"))
Scyther.init(bindir)
""" """
Create and show the splash screen. It will then create and show Create and show the splash screen. It will then create and show
the main frame when it is time to do so. the main frame when it is time to do so.