comparison mercurial/util_win32.py @ 5083:73169e5d2732

posixfile_nt: '+' was understood as read mode instead of update.
author Patrick Mezard <pmezard@gmail.com>
date Tue, 17 Jul 2007 23:33:42 +0200
parents 7549cd526b7f
children 81f8ff2a9bf2
comparison
equal deleted inserted replaced
5081:167c422c745f 5083:73169e5d2732
207 # tried to use win32file._open_osfhandle to pass fd to os.fdopen, 207 # tried to use win32file._open_osfhandle to pass fd to os.fdopen,
208 # but does not work at all. wrap win32 file api instead. 208 # but does not work at all. wrap win32 file api instead.
209 209
210 def __init__(self, name, mode='rb'): 210 def __init__(self, name, mode='rb'):
211 access = 0 211 access = 0
212 if 'r' in mode or '+' in mode: 212 if 'r' in mode:
213 access |= win32file.GENERIC_READ 213 access |= win32file.GENERIC_READ
214 if 'w' in mode or 'a' in mode: 214 if 'w' in mode or 'a' in mode or '+' in mode:
215 access |= win32file.GENERIC_WRITE 215 access |= win32file.GENERIC_WRITE
216 if 'r' in mode: 216 if 'r' in mode:
217 creation = win32file.OPEN_EXISTING 217 creation = win32file.OPEN_EXISTING
218 elif 'a' in mode: 218 elif 'a' in mode:
219 creation = win32file.OPEN_ALWAYS 219 creation = win32file.OPEN_ALWAYS