Merge pull request #191 from RhetTbull/revert-190-Fix133

Revert "Fix FileExistsError when filename differs only in case and export-as-hardlink (Bug#133)"
This commit is contained in:
Rhet Turnbull
2020-07-22 22:18:19 -07:00
committed by GitHub

View File

@@ -34,7 +34,7 @@ from .._constants import (
from .._export_db import ExportDBNoOp from .._export_db import ExportDBNoOp
from ..exiftool import ExifTool from ..exiftool import ExifTool
from ..fileutil import FileUtil from ..fileutil import FileUtil
from ..utils import dd_to_dms_str, findfiles from ..utils import dd_to_dms_str
ExportResults = namedtuple( ExportResults = namedtuple(
"ExportResults", ["exported", "new", "updated", "skipped", "exif_updated"] "ExportResults", ["exported", "new", "updated", "skipped", "exif_updated"]
@@ -428,10 +428,11 @@ def export2(
# dest will be file1 (1).jpeg even though file1.jpeg doesn't exist to prevent sidecar collision # dest will be file1 (1).jpeg even though file1.jpeg doesn't exist to prevent sidecar collision
if not update and increment and not overwrite: if not update and increment and not overwrite:
count = 1 count = 1
dest_files = findfiles(f"{dest.stem}*", str(dest.parent)) glob_str = str(dest.parent / f"{dest.stem}*")
dest_files = [pathlib.Path(f).stem.lower() for f in dest_files] dest_files = glob.glob(glob_str)
dest_files = [pathlib.Path(f).stem for f in dest_files]
dest_new = dest.stem dest_new = dest.stem
while dest_new.lower() in dest_files: while dest_new in dest_files:
dest_new = f"{dest.stem} ({count})" dest_new = f"{dest.stem} ({count})"
count += 1 count += 1
dest = dest.parent / f"{dest_new}{dest.suffix}" dest = dest.parent / f"{dest_new}{dest.suffix}"