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

@@ -10,6 +10,7 @@ import logging
import re
import os
import os.path as op
from errno import EISDIR
from xml.etree import ElementTree as ET
from hscommon.jobprogress.job import nulljob
@@ -375,9 +376,8 @@ class Results(Markable):
try:
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, 13 is what we get on Windows.
if e.errno in {21, 13}:
# If our OSError is because dest is already a directory, we want to handle that.
if e.errno == EISDIR:
p = str(outfile)
dirname, basename = op.split(p)
otherfiles = os.listdir(dirname)