win32: remove try-catch block of GetModuleFileNameEx (issue2480)
According to the API document, GetModuleFileName is the preferred way to
retrieve the filename of the current process. So we shouldn't try
GetModuleFileName'Ex' first.
Previously system_rcpath_win32() happened to return unicode paths due to
GetModuleFileNameEx (issue2480). This problem is fixed as GetModuleFileName
never return unicode.
--- a/mercurial/win32.py Tue Nov 09 20:25:56 2010 +0000
+++ b/mercurial/win32.py Thu Nov 11 01:12:51 2010 +0900
@@ -102,12 +102,7 @@
def system_rcpath_win32():
'''return default os-specific hgrc search path'''
- proc = win32api.GetCurrentProcess()
- try:
- # This will fail on windows < NT
- filename = win32process.GetModuleFileNameEx(proc, 0)
- except:
- filename = win32api.GetModuleFileName(0)
+ filename = win32api.GetModuleFileName(0)
# Use mercurial.ini found in directory with hg.exe
progrc = os.path.join(os.path.dirname(filename), 'mercurial.ini')
if os.path.isfile(progrc):