mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-05-08 09:49:51 +00:00
Compare commits
1 Commits
e4219fada2
...
820daf4682
Author | SHA1 | Date | |
---|---|---|---|
|
820daf4682 |
@ -10,7 +10,6 @@ import logging
|
||||
import re
|
||||
import os
|
||||
import os.path as op
|
||||
from errno import EISDIR, EACCES
|
||||
from xml.etree import ElementTree as ET
|
||||
|
||||
from hscommon.jobprogress.job import nulljob
|
||||
@ -377,8 +376,8 @@ class Results(Markable):
|
||||
do_write(outfile)
|
||||
except OSError as e:
|
||||
# If our OSError is because dest is already a directory, we want to handle that. 21 is
|
||||
# the code we get on OS X and Linux (EISDIR), 13 is what we get on Windows (EACCES).
|
||||
if e.errno in (EISDIR, EACCES):
|
||||
# the code we get on OS X and Linux, 13 is what we get on Windows.
|
||||
if e.errno in {21, 13}:
|
||||
p = str(outfile)
|
||||
dirname, basename = op.split(p)
|
||||
otherfiles = os.listdir(dirname)
|
||||
|
@ -14,7 +14,6 @@ import re
|
||||
import os
|
||||
import shutil
|
||||
|
||||
from errno import EISDIR, EACCES
|
||||
from pathlib import Path
|
||||
from typing import Callable, List
|
||||
|
||||
@ -76,8 +75,10 @@ def smart_copy(source_path: Path, dest_path: Path) -> None:
|
||||
try:
|
||||
_smart_move_or_copy(shutil.copy, source_path, dest_path)
|
||||
except OSError as e:
|
||||
# It's a directory, code is 21 on OS X / Linux (EISDIR) and 13 on Windows (EACCES)
|
||||
if e.errno in (EISDIR, EACCES):
|
||||
if e.errno in {
|
||||
21,
|
||||
13,
|
||||
}: # it's a directory, code is 21 on OS X / Linux and 13 on Windows
|
||||
_smart_move_or_copy(shutil.copytree, source_path, dest_path)
|
||||
else:
|
||||
raise
|
||||
|
Loading…
x
Reference in New Issue
Block a user