1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2024-11-04 23:39:02 +00:00

Also look for errno.EACCES to ensure compatibility with Windows

This commit is contained in:
Luca Falavigna 2024-02-12 11:33:40 +01:00
parent 5b00de9a43
commit f16fce64b7
2 changed files with 4 additions and 4 deletions

View File

@ -10,7 +10,7 @@ import logging
import re
import os
import os.path as op
from errno import EISDIR
from errno import EISDIR, EACCES
from xml.etree import ElementTree as ET
from hscommon.jobprogress.job import nulljob
@ -377,7 +377,7 @@ 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.
if e.errno == EISDIR:
if e.errno in (EISDIR, EACCES):
p = str(outfile)
dirname, basename = op.split(p)
otherfiles = os.listdir(dirname)

View File

@ -14,7 +14,7 @@ import re
import os
import shutil
from errno import EISDIR
rom errno import EISDIR, EACCES
from pathlib import Path
from typing import Callable, List
@ -76,7 +76,7 @@ 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:
if e.errno == EISDIR: # it's a directory
if e.errno in (EISDIR, EACCES): # it's a directory
_smart_move_or_copy(shutil.copytree, source_path, dest_path)
else:
raise