Show More
@@ -536,12 +536,16 b" if os.name == 'nt':" | |||||
536 | def os_rcpath(): |
|
536 | def os_rcpath(): | |
537 | '''return default os-specific hgrc search path''' |
|
537 | '''return default os-specific hgrc search path''' | |
538 | path = system_rcpath() |
|
538 | path = system_rcpath() | |
539 | path.append(os.path.join(os.path.expanduser('~'), 'mercurial.ini')) |
|
539 | path.append(user_rcpath()) | |
540 | userprofile = os.environ.get('USERPROFILE') |
|
540 | userprofile = os.environ.get('USERPROFILE') | |
541 | if userprofile: |
|
541 | if userprofile: | |
542 | path.append(os.path.join(userprofile, 'mercurial.ini')) |
|
542 | path.append(os.path.join(userprofile, 'mercurial.ini')) | |
543 | return path |
|
543 | return path | |
544 |
|
544 | |||
|
545 | def user_rcpath(): | |||
|
546 | '''return os-specific hgrc search path to the user dir''' | |||
|
547 | return os.path.join(os.path.expanduser('~'), 'mercurial.ini') | |||
|
548 | ||||
545 | def parse_patch_output(output_line): |
|
549 | def parse_patch_output(output_line): | |
546 | """parses the output produced by patch and returns the file name""" |
|
550 | """parses the output produced by patch and returns the file name""" | |
547 | pf = output_line[14:] |
|
551 | pf = output_line[14:] |
@@ -16,7 +16,7 b' import win32api' | |||||
16 | from demandload import * |
|
16 | from demandload import * | |
17 | from i18n import gettext as _ |
|
17 | from i18n import gettext as _ | |
18 | demandload(globals(), 'errno os pywintypes win32con win32file win32process') |
|
18 | demandload(globals(), 'errno os pywintypes win32con win32file win32process') | |
19 | demandload(globals(), 'cStringIO winerror') |
|
19 | demandload(globals(), 'cStringIO win32com.shell:shell,shellcon winerror') | |
20 |
|
20 | |||
21 | class WinError: |
|
21 | class WinError: | |
22 | winerror_map = { |
|
22 | winerror_map = { | |
@@ -183,6 +183,17 b' def system_rcpath_win32():' | |||||
183 | filename = win32process.GetModuleFileNameEx(proc, 0) |
|
183 | filename = win32process.GetModuleFileNameEx(proc, 0) | |
184 | return [os.path.join(os.path.dirname(filename), 'mercurial.ini')] |
|
184 | return [os.path.join(os.path.dirname(filename), 'mercurial.ini')] | |
185 |
|
185 | |||
|
186 | def user_rcpath(): | |||
|
187 | '''return os-specific hgrc search path to the user dir''' | |||
|
188 | userdir = os.path.expanduser('~') | |||
|
189 | if userdir == '~': | |||
|
190 | # We are on win < nt: fetch the APPDATA directory location and use | |||
|
191 | # the parent directory as the user home dir. | |||
|
192 | appdir = shell.SHGetPathFromIDList( | |||
|
193 | qshell.SHGetSpecialFolderLocation(0, shellcon.CSIDL_APPDATA)) | |||
|
194 | userdir = os.path.dirname(appdir) | |||
|
195 | return os.path.join(userdir, 'mercurial.ini') | |||
|
196 | ||||
186 | class posixfile_nt(object): |
|
197 | class posixfile_nt(object): | |
187 | '''file object with posix-like semantics. on windows, normal |
|
198 | '''file object with posix-like semantics. on windows, normal | |
188 | files can not be deleted or renamed if they are open. must open |
|
199 | files can not be deleted or renamed if they are open. must open |
General Comments 0
You need to be logged in to leave comments.
Login now