mercurial/util.py
changeset 1399 9a70776e355e
parent 1391 9395c2f94130
child 1400 cf9a1233738a
equal deleted inserted replaced
1398:3f76ac60130d 1399:9a70776e355e
   368         raise OSError(0, "Hardlinks not supported")
   368         raise OSError(0, "Hardlinks not supported")
   369 
   369 
   370 # Platform specific variants
   370 # Platform specific variants
   371 if os.name == 'nt':
   371 if os.name == 'nt':
   372     nulldev = 'NUL:'
   372     nulldev = 'NUL:'
   373 
   373     
   374     rcpath = (r'c:\mercurial\mercurial.ini',
   374     try:
       
   375         import win32api, win32process
       
   376         filename = win32process.GetModuleFileNameEx(win32api.GetCurrentProcess(), 0)
       
   377         systemrc = os.path.join(os.path.dirname(filename), 'mercurial.ini')
       
   378         
       
   379     except ImportError:
       
   380         systemrc = r'c:\mercurial\mercurial.ini'
       
   381         pass
       
   382 
       
   383     rcpath = (systemrc,
   375               os.path.join(os.path.expanduser('~'), 'mercurial.ini'))
   384               os.path.join(os.path.expanduser('~'), 'mercurial.ini'))
   376 
   385 
   377     def parse_patch_output(output_line):
   386     def parse_patch_output(output_line):
   378         """parses the output produced by patch and returns the file name"""
   387         """parses the output produced by patch and returns the file name"""
   379         pf = output_line[14:]
   388         pf = output_line[14:]