Skip to content

Commit 1fcd6ff

Browse files
author
Federico Fissore
committed
ArchiveExtractor was not making symlinks the right way
1 parent ecde17b commit 1fcd6ff

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

arduino-core/src/cc/arduino/utils/ArchiveExtractor.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public void extract(File archiveFile, File destFolder, int stripPath, boolean ov
112112

113113
Map<File, File> hardLinks = new HashMap<File, File>();
114114
Map<File, Integer> hardLinksMode = new HashMap<File, Integer>();
115-
Map<File, File> symLinks = new HashMap<File, File>();
115+
Map<File, String> symLinks = new HashMap<File, String>();
116116
Map<File, Long> symLinksModifiedTimes = new HashMap<File, Long>();
117117

118118
// Cycle through all the archive entries
@@ -227,7 +227,7 @@ public void extract(File archiveFile, File destFolder, int stripPath, boolean ov
227227
hardLinks.put(outputFile, outputLinkedFile);
228228
hardLinksMode.put(outputFile, mode);
229229
} else if (isSymLink) {
230-
symLinks.put(outputFile, outputLinkedFile);
230+
symLinks.put(outputFile, linkName);
231231
symLinksModifiedTimes.put(outputFile, modifiedTime);
232232
} else {
233233
// Create the containing folder if not exists
@@ -255,7 +255,7 @@ public void extract(File archiveFile, File destFolder, int stripPath, boolean ov
255255
}
256256
}
257257

258-
for (Map.Entry<File, File> entry : symLinks.entrySet()) {
258+
for (Map.Entry<File, String> entry : symLinks.entrySet()) {
259259
if (entry.getKey().exists() && overwrite) {
260260
entry.getKey().delete();
261261
}

arduino-core/src/processing/app/Platform.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,8 @@ public String getOsArch() {
216216
return System.getProperty("os.arch");
217217
}
218218

219-
public void symlink(File something, File somewhere) throws IOException, InterruptedException {
220-
Process process = Runtime.getRuntime().exec(new String[]{"ln", "-s", something.getAbsolutePath(), somewhere.getAbsolutePath()}, null, null);
219+
public void symlink(String something, File somewhere) throws IOException, InterruptedException {
220+
Process process = Runtime.getRuntime().exec(new String[]{"ln", "-s", something, somewhere.getAbsolutePath()}, null, somewhere.getParentFile());
221221
process.waitFor();
222222
}
223223

0 commit comments

Comments
 (0)