From 9fb61bec46014cee5e57b681a6c408342d0a9d9e Mon Sep 17 00:00:00 2001 From: Brian Matherly Date: Thu, 8 May 2008 12:08:19 +0000 Subject: [PATCH] 0002142: Patch to const.py.in to enable py2exe svn: r10693 --- src/const.py.in | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/const.py.in b/src/const.py.in index 218f46650..0c99708a7 100644 --- a/src/const.py.in +++ b/src/const.py.in @@ -31,6 +31,7 @@ Provides constants for other modules # #------------------------------------------------------------------------- import os +import sys from gettext import gettext as _ #------------------------------------------------------------------------- @@ -94,7 +95,14 @@ else: # this one, and that the plugins directory is in a directory below this. # #------------------------------------------------------------------------- -ROOT_DIR = os.path.abspath(os.path.dirname(__file__)) +# test for sys.frozen to detect a py2exe executable on Windows +if hasattr(sys, "frozen"): + ROOT_DIR = os.path.abspath(os.path.dirname( + unicode(sys.executable, sys.getfilesystemencoding()))) +else: + ROOT_DIR = os.path.abspath(os.path.dirname( + unicode(__file__, sys.getfilesystemencoding()))) + IMAGE_DIR = os.path.join(ROOT_DIR, "images") CUSTOM_FILTERS = os.path.join(HOME_DIR, "custom_filters.xml") @@ -244,3 +252,4 @@ LONGOPTS = [ SHORTOPTS = "O:i:o:f:a:p:d:lLhu?" +