Skip to content

Commit 9b6b399

Browse files
Bananeweizenslachiewicz
authored andcommitted
Normalize file separators before warning about equal archive entries
Fixes #248.
1 parent b5e8974 commit 9b6b399

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main/java/org/codehaus/plexus/archiver/AbstractUnArchiver.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ protected boolean shouldExtractEntry( File targetDirectory, File targetFileName,
426426
"" )
427427
+ suffix;
428428
boolean fileOnDiskIsOlderThanEntry = targetFileName.lastModified() < entryDate.getTime();
429-
boolean differentCasing = !entryName.equals( relativeCanonicalDestPath );
429+
boolean differentCasing = !normalizedFileSeparator( entryName ).equals( normalizedFileSeparator( relativeCanonicalDestPath ) );
430430

431431
// Warn for case (4) and (5) if the file system is case-insensitive
432432
if ( differentCasing )
@@ -440,5 +440,8 @@ protected boolean shouldExtractEntry( File targetDirectory, File targetFileName,
440440
// Override the existing file if isOverwrite() is true or if the file on disk is older than the one in the archive
441441
return isOverwrite() || fileOnDiskIsOlderThanEntry;
442442
}
443-
443+
444+
private String normalizedFileSeparator(String pathOrEntry) {
445+
return pathOrEntry.replace("/", File.separator);
446+
}
444447
}

0 commit comments

Comments
 (0)