From d30f2c0c51e3cb5695bc2e4a5c27e9bc55f73b89 Mon Sep 17 00:00:00 2001 From: Brian Matherly Date: Thu, 8 May 2008 12:06:39 +0000 Subject: [PATCH] 0002142: Patch to const.py.in to enable py2exe svn: r10692 --- 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 035072c50..bad57a303 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:lhu?" +