mercurial/win32.py
branchstable
changeset 19159 1b329f8c7b24
parent 18959 2f6418d8a4c9
child 20425 ca6aa8362f33
equal deleted inserted replaced
19156:ed1a212193dc 19159:1b329f8c7b24
   342     return pi.dwProcessId
   342     return pi.dwProcessId
   343 
   343 
   344 def unlink(f):
   344 def unlink(f):
   345     '''try to implement POSIX' unlink semantics on Windows'''
   345     '''try to implement POSIX' unlink semantics on Windows'''
   346 
   346 
       
   347     if os.path.isdir(f):
       
   348         # use EPERM because it is POSIX prescribed value, even though
       
   349         # unlink(2) on directories returns EISDIR on Linux
       
   350         raise IOError(errno.EPERM,
       
   351                       "Unlinking directory not permitted: '%s'" % f)
       
   352 
   347     # POSIX allows to unlink and rename open files. Windows has serious
   353     # POSIX allows to unlink and rename open files. Windows has serious
   348     # problems with doing that:
   354     # problems with doing that:
   349     # - Calling os.unlink (or os.rename) on a file f fails if f or any
   355     # - Calling os.unlink (or os.rename) on a file f fails if f or any
   350     #   hardlinked copy of f has been opened with Python's open(). There is no
   356     #   hardlinked copy of f has been opened with Python's open(). There is no
   351     #   way such a file can be deleted or renamed on Windows (other than
   357     #   way such a file can be deleted or renamed on Windows (other than