Skip to content

Commit

Permalink
Normalize file separators before warning about equal archive entries
Browse files Browse the repository at this point in the history
Fixes #248.
  • Loading branch information
Bananeweizen authored and slachiewicz committed Dec 31, 2022
1 parent b5e8974 commit 9b6b399
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ protected boolean shouldExtractEntry( File targetDirectory, File targetFileName,
"" )
+ suffix;
boolean fileOnDiskIsOlderThanEntry = targetFileName.lastModified() < entryDate.getTime();
boolean differentCasing = !entryName.equals( relativeCanonicalDestPath );
boolean differentCasing = !normalizedFileSeparator( entryName ).equals( normalizedFileSeparator( relativeCanonicalDestPath ) );

// Warn for case (4) and (5) if the file system is case-insensitive
if ( differentCasing )
Expand All @@ -440,5 +440,8 @@ protected boolean shouldExtractEntry( File targetDirectory, File targetFileName,
// Override the existing file if isOverwrite() is true or if the file on disk is older than the one in the archive
return isOverwrite() || fileOnDiskIsOlderThanEntry;
}


private String normalizedFileSeparator(String pathOrEntry) {
return pathOrEntry.replace("/", File.separator);
}
}

0 comments on commit 9b6b399

Please sign in to comment.