##// END OF EJS Templates
windows: avoid deleting non-empty reparse points...
Henrik Stuart -
r8364:fa901423 default
parent child Browse files
Show More
@@ -240,6 +240,33 b' def groupname(gid=None):'
240 240 If gid is None, return the name of the current group."""
241 241 return None
242 242
243 def _removedirs(name):
244 """special version of os.removedirs that does not remove symlinked
245 directories or junction points if they actually contain files"""
246 if osutil.listdir(name):
247 return
248 os.rmdir(name)
249 head, tail = os.path.split(name)
250 if not tail:
251 head, tail = os.path.split(head)
252 while head and tail:
253 try:
254 if osutil.listdir(name):
255 return
256 os.rmdir(head)
257 except:
258 break
259 head, tail = os.path.split(head)
260
261 def unlink(f):
262 """unlink and remove the directory if it is empty"""
263 os.unlink(f)
264 # try removing directories that might now be empty
265 try:
266 _removedirs(os.path.dirname(f))
267 except OSError:
268 pass
269
243 270 try:
244 271 # override functions with win32 versions if possible
245 272 from win32 import *
General Comments 0
You need to be logged in to leave comments. Login now