equal
deleted
inserted
replaced
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 |