Skip to content

Commit

Permalink
merge #5807: [path] fix moving files across drives on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Jun 29, 2024
2 parents 29eb535 + de61b3b commit 1ca2cf5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions gallery_dl/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,13 +338,13 @@ def finalize(self):
while True:
try:
os.replace(self.temppath, self.realpath)
except FileNotFoundError:
# delayed directory creation
os.makedirs(self.realdirectory)
continue
except OSError:
# move across different filesystems
shutil.copyfile(self.temppath, self.realpath)
try:
shutil.copyfile(self.temppath, self.realpath)
except FileNotFoundError:
os.makedirs(self.realdirectory)
shutil.copyfile(self.temppath, self.realpath)
os.unlink(self.temppath)
break

Expand Down

0 comments on commit 1ca2cf5

Please sign in to comment.