[Spambayes-checkins] spambayes/Outlook2000 manager.py,1.39,1.40
Mark Hammond
mhammond at users.sourceforge.net
Thu Jan 9 16:33:12 EST 2003
Update of /cvsroot/spambayes/spambayes/Outlook2000
In directory sc8-pr-cvs1:/tmp/cvs-serv5171
Modified Files:
manager.py
Log Message:
Give the manager an "application_directory" attribute to save everyone
duplicating this logic to locate the images, html, etc.
Index: manager.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/manager.py,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -d -r1.39 -r1.40
*** manager.py 15 Dec 2002 14:03:58 -0000 1.39
--- manager.py 10 Jan 2003 00:33:10 -0000 1.40
***************
*** 18,24 ****
True, False = 1, 0
try:
if hasattr(sys, "frozen"):
! this_filename = os.path.abspath(sys.argv[0])
else:
this_filename = os.path.abspath(__file__)
--- 18,32 ----
True, False = 1, 0
+ # Work out our "application directory", which is
+ # the directory of our main .py/.dll/.exe file we
+ # are running from.
try:
if hasattr(sys, "frozen"):
! if sys.frozen == "dll":
! import win32api
! this_filename = win32api.GetModuleFileName(sys.frozendllhandle)
! else:
! # Don't think we will ever run as a .EXE, but...
! this_filename = os.path.abspath(sys.argv[0])
else:
this_filename = os.path.abspath(__file__)
***************
*** 54,59 ****
self.addin = None
self.verbose = verbose
if not os.path.isabs(config_base):
! config_base = os.path.join(os.path.dirname(this_filename),
config_base)
config_base = os.path.abspath(config_base)
--- 62,68 ----
self.addin = None
self.verbose = verbose
+ self.application_directory = os.path.dirname(this_filename)
if not os.path.isabs(config_base):
! config_base = os.path.join(self.application_directory,
config_base)
config_base = os.path.abspath(config_base)
More information about the Spambayes-checkins
mailing list