ArchiveExtractor was not making symlinks the right way

This commit is contained in:
Federico Fissore 2015-03-30 17:12:38 +02:00
parent ecde17b6e2
commit 1fcd6ff1ce
2 changed files with 5 additions and 5 deletions

View File

@ -112,7 +112,7 @@ public class ArchiveExtractor {
Map<File, File> hardLinks = new HashMap<File, File>(); Map<File, File> hardLinks = new HashMap<File, File>();
Map<File, Integer> hardLinksMode = new HashMap<File, Integer>(); Map<File, Integer> hardLinksMode = new HashMap<File, Integer>();
Map<File, File> symLinks = new HashMap<File, File>(); Map<File, String> symLinks = new HashMap<File, String>();
Map<File, Long> symLinksModifiedTimes = new HashMap<File, Long>(); Map<File, Long> symLinksModifiedTimes = new HashMap<File, Long>();
// Cycle through all the archive entries // Cycle through all the archive entries
@ -227,7 +227,7 @@ public class ArchiveExtractor {
hardLinks.put(outputFile, outputLinkedFile); hardLinks.put(outputFile, outputLinkedFile);
hardLinksMode.put(outputFile, mode); hardLinksMode.put(outputFile, mode);
} else if (isSymLink) { } else if (isSymLink) {
symLinks.put(outputFile, outputLinkedFile); symLinks.put(outputFile, linkName);
symLinksModifiedTimes.put(outputFile, modifiedTime); symLinksModifiedTimes.put(outputFile, modifiedTime);
} else { } else {
// Create the containing folder if not exists // Create the containing folder if not exists
@ -255,7 +255,7 @@ public class ArchiveExtractor {
} }
} }
for (Map.Entry<File, File> entry : symLinks.entrySet()) { for (Map.Entry<File, String> entry : symLinks.entrySet()) {
if (entry.getKey().exists() && overwrite) { if (entry.getKey().exists() && overwrite) {
entry.getKey().delete(); entry.getKey().delete();
} }

View File

@ -216,8 +216,8 @@ public class Platform {
return System.getProperty("os.arch"); return System.getProperty("os.arch");
} }
public void symlink(File something, File somewhere) throws IOException, InterruptedException { public void symlink(String something, File somewhere) throws IOException, InterruptedException {
Process process = Runtime.getRuntime().exec(new String[]{"ln", "-s", something.getAbsolutePath(), somewhere.getAbsolutePath()}, null, null); Process process = Runtime.getRuntime().exec(new String[]{"ln", "-s", something, somewhere.getAbsolutePath()}, null, somewhere.getParentFile());
process.waitFor(); process.waitFor();
} }