Repository: commons-compress Updated Branches: refs/heads/master c03704d77 -> e9f2dadb9
getCanonicalPath may return a path ending in a / already Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/e9f2dadb Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/e9f2dadb Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/e9f2dadb Branch: refs/heads/master Commit: e9f2dadb916063c1e97ab2bbf41bee059e277c19 Parents: c03704d Author: Stefan Bodewig <[email protected]> Authored: Thu Jun 28 17:54:35 2018 +0200 Committer: Stefan Bodewig <[email protected]> Committed: Thu Jun 28 17:54:56 2018 +0200 ---------------------------------------------------------------------- .../apache/commons/compress/archivers/examples/Expander.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-compress/blob/e9f2dadb/src/main/java/org/apache/commons/compress/archivers/examples/Expander.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/compress/archivers/examples/Expander.java b/src/main/java/org/apache/commons/compress/archivers/examples/Expander.java index 5644451..cfaba87 100644 --- a/src/main/java/org/apache/commons/compress/archivers/examples/Expander.java +++ b/src/main/java/org/apache/commons/compress/archivers/examples/Expander.java @@ -238,7 +238,10 @@ public class Expander { private void expand(ArchiveEntrySupplier supplier, EntryWriter writer, File targetDirectory) throws IOException { - String targetDirPath = targetDirectory.getCanonicalPath() + File.separatorChar; + String targetDirPath = targetDirectory.getCanonicalPath(); + if (!targetDirPath.endsWith(File.separator)) { + targetDirPath += File.separatorChar; + } ArchiveEntry nextEntry = supplier.getNextReadableEntry(); while (nextEntry != null) { File f = new File(targetDirectory, nextEntry.getName());
