1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2026-03-12 19:41:38 +00:00

Use errno.EISDIR instead of hardcoding values

This commit is contained in:
Luca Falavigna
2024-02-12 08:36:11 +01:00
parent 4385b50825
commit 5b00de9a43
2 changed files with 5 additions and 7 deletions

View File

@@ -14,6 +14,7 @@ import re
import os
import shutil
from errno import EISDIR
from pathlib import Path
from typing import Callable, List
@@ -75,10 +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 in {
21,
13,
}: # it's a directory, code is 21 on OS X / Linux and 13 on Windows
if e.errno == EISDIR: # it's a directory
_smart_move_or_copy(shutil.copytree, source_path, dest_path)
else:
raise