--- a/mercurial/util_win32.py Sun May 14 21:07:34 2006 -0700
+++ b/mercurial/util_win32.py Sun May 14 23:44:50 2006 -0700
@@ -16,7 +16,7 @@
from demandload import *
from i18n import gettext as _
demandload(globals(), 'errno os pywintypes win32con win32file win32process')
-demandload(globals(), 'cStringIO winerror')
+demandload(globals(), 'cStringIO win32com.shell:shell,shellcon winerror')
class WinError:
winerror_map = {
@@ -183,6 +183,17 @@
filename = win32process.GetModuleFileNameEx(proc, 0)
return [os.path.join(os.path.dirname(filename), 'mercurial.ini')]
+def user_rcpath():
+ '''return os-specific hgrc search path to the user dir'''
+ userdir = os.path.expanduser('~')
+ if userdir == '~':
+ # We are on win < nt: fetch the APPDATA directory location and use
+ # the parent directory as the user home dir.
+ appdir = shell.SHGetPathFromIDList(
+ qshell.SHGetSpecialFolderLocation(0, shellcon.CSIDL_APPDATA))
+ userdir = os.path.dirname(appdir)
+ return os.path.join(userdir, 'mercurial.ini')
+
class posixfile_nt(object):
'''file object with posix-like semantics. on windows, normal
files can not be deleted or renamed if they are open. must open