changeset 1399:9a70776e355e

Try to use ini-file in the same directory as the exe as the default on NT.
author Zbynek Winkler <zwin@users.sourceforge.net>
date Tue, 18 Oct 2005 17:57:27 -0700
parents 3f76ac60130d
children cf9a1233738a
files mercurial/util.py
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/util.py	Tue Oct 18 17:56:50 2005 -0700
+++ b/mercurial/util.py	Tue Oct 18 17:57:27 2005 -0700
@@ -370,8 +370,17 @@
 # Platform specific variants
 if os.name == 'nt':
     nulldev = 'NUL:'
+    
+    try:
+        import win32api, win32process
+        filename = win32process.GetModuleFileNameEx(win32api.GetCurrentProcess(), 0)
+        systemrc = os.path.join(os.path.dirname(filename), 'mercurial.ini')
+        
+    except ImportError:
+        systemrc = r'c:\mercurial\mercurial.ini'
+        pass
 
-    rcpath = (r'c:\mercurial\mercurial.ini',
+    rcpath = (systemrc,
               os.path.join(os.path.expanduser('~'), 'mercurial.ini'))
 
     def parse_patch_output(output_line):