changeset 1834:24881eaebee3

Fixes running 'hg serve' with Windows executable and no explicit template path configured. PY2EXE executables don't support __file__ but do place the directory of the shared code library into sys.prefix. Fixes bug 152.
author Lee Cantey <lcantey@gmail.com>
date Fri, 03 Mar 2006 13:41:12 -0800
parents fc959d6ffb13
children bdfb524d728a
files mercurial/hgweb.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb.py	Fri Mar 03 13:24:26 2006 -0800
+++ b/mercurial/hgweb.py	Fri Mar 03 13:41:12 2006 -0800
@@ -20,6 +20,10 @@
         p = os.path.join(os.path.dirname(__file__), f)
         if os.path.isdir(p):
             return os.path.normpath(p)
+    else:
+       # executable version (py2exe) doesn't support __file__
+        if hasattr(sys, 'frozen'):
+            return os.path.join(sys.prefix, "templates")
 
 def age(x):
     def plural(t, c):