parent
feb470d19a
commit
9c8647a4fd
@ -317,11 +317,18 @@ class PathFormat():
|
||||
|
||||
if self.temppath != self.realpath:
|
||||
# Move temp file to its actual location
|
||||
try:
|
||||
os.replace(self.temppath, self.realpath)
|
||||
except OSError:
|
||||
shutil.copyfile(self.temppath, self.realpath)
|
||||
os.unlink(self.temppath)
|
||||
while True:
|
||||
try:
|
||||
os.replace(self.temppath, self.realpath)
|
||||
except FileNotFoundError:
|
||||
# delayed directory creation
|
||||
os.makedirs(self.realdirectory, exist_ok=True)
|
||||
continue
|
||||
except OSError:
|
||||
# move across different filesystems
|
||||
shutil.copyfile(self.temppath, self.realpath)
|
||||
os.unlink(self.temppath)
|
||||
break
|
||||
|
||||
mtime = self.kwdict.get("_mtime")
|
||||
if mtime:
|
||||
|
Loading…
x
Reference in New Issue
Block a user