@@ -317,11 +317,18 @@ class PathFormat():
|
|||||||
|
|
||||||
if self.temppath != self.realpath:
|
if self.temppath != self.realpath:
|
||||||
# Move temp file to its actual location
|
# Move temp file to its actual location
|
||||||
try:
|
while True:
|
||||||
os.replace(self.temppath, self.realpath)
|
try:
|
||||||
except OSError:
|
os.replace(self.temppath, self.realpath)
|
||||||
shutil.copyfile(self.temppath, self.realpath)
|
except FileNotFoundError:
|
||||||
os.unlink(self.temppath)
|
# 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")
|
mtime = self.kwdict.get("_mtime")
|
||||||
if mtime:
|
if mtime:
|
||||||
|
|||||||
Reference in New Issue
Block a user