diff --git a/arduino-core/src/cc/arduino/contributions/packages/HostDependentDownloadableContribution.java b/arduino-core/src/cc/arduino/contributions/packages/HostDependentDownloadableContribution.java
index c8d57234a..0e4a41dac 100644
--- a/arduino-core/src/cc/arduino/contributions/packages/HostDependentDownloadableContribution.java
+++ b/arduino-core/src/cc/arduino/contributions/packages/HostDependentDownloadableContribution.java
@@ -45,8 +45,6 @@ public abstract class HostDependentDownloadableContribution extends Downloadable
Properties prop = System.getProperties();
String osName = prop.getProperty("os.name");
String osArch = prop.getProperty("os.arch");
- // for (Object k : properties.keySet())
- // System.out.println(k + " = " + properties.get(k));
String host = getHost();
diff --git a/arduino-core/src/cc/arduino/os/FileNativeUtils.java b/arduino-core/src/cc/arduino/os/FileNativeUtils.java
index 885729461..25afdaf69 100644
--- a/arduino-core/src/cc/arduino/os/FileNativeUtils.java
+++ b/arduino-core/src/cc/arduino/os/FileNativeUtils.java
@@ -59,33 +59,33 @@ public class FileNativeUtils {
* Create a hard link from oldFile to newFile. If the underlying
* filesystem doesn't support hard links then the command is ignored.
*
- * @param oldFile
- * @param newFile
+ * @param something
+ * @param somewhere
* @throws IOException
*/
- public static void link(File oldFile, File newFile) throws IOException {
+ public static void link(File something, File somewhere) throws IOException {
if (OSUtils.isLinux())
- LinuxFileNativeUtils.link(oldFile, newFile);
+ LinuxFileNativeUtils.link(something, somewhere);
if (OSUtils.isMacOS())
- MacOSFileNativeUtils.link(oldFile, newFile);
+ MacOSFileNativeUtils.link(something, somewhere);
if (OSUtils.isWindows())
- WindowsFileNativeUtils.link(oldFile, newFile);
+ WindowsFileNativeUtils.link(something, somewhere);
}
/**
* Create a symlink link from oldFile to newFile. If the
* underlying filesystem doesn't support symlinks then the command is ignored.
*
- * @param oldFile
- * @param newFile
+ * @param something
+ * @param somewhere
* @throws IOException
*/
- public static void symlink(File oldFile, File newFile) throws IOException {
+ public static void symlink(File something, File somewhere) throws IOException {
if (OSUtils.isLinux())
- LinuxFileNativeUtils.symlink(oldFile, newFile);
+ LinuxFileNativeUtils.symlink(something, somewhere);
if (OSUtils.isMacOS())
- MacOSFileNativeUtils.symlink(oldFile, newFile);
+ MacOSFileNativeUtils.symlink(something, somewhere);
if (OSUtils.isWindows())
- WindowsFileNativeUtils.symlink(oldFile, newFile);
+ WindowsFileNativeUtils.symlink(something, somewhere);
}
}
diff --git a/arduino-core/src/cc/arduino/os/linux/LibCNative.java b/arduino-core/src/cc/arduino/os/linux/LibCNative.java
index 11739dc79..73e571834 100644
--- a/arduino-core/src/cc/arduino/os/linux/LibCNative.java
+++ b/arduino-core/src/cc/arduino/os/linux/LibCNative.java
@@ -35,18 +35,16 @@ import com.sun.jna.Pointer;
public interface LibCNative extends Library {
- static LibCNative libc = (LibCNative) Native.loadLibrary("c",
- LibCNative.class);
+ LibCNative libc = (LibCNative) Native.loadLibrary("c", LibCNative.class);
- Pointer errno = NativeLibrary.getInstance("c")
- .getGlobalVariableAddress("errno");
+ Pointer errno = NativeLibrary.getInstance("c").getGlobalVariableAddress("errno");
- public int chmod(String path, int mode);
+ int chmod(String path, int mode);
- public int link(String oldpath, String newpath);
+ int link(String something, String somewhere);
- public int symlink(String oldpath, String newpath);
+ int symlink(String something, String somewhere);
- public String strerror(int errno);
+ String strerror(int errno);
}
diff --git a/arduino-core/src/cc/arduino/os/linux/LinuxFileNativeUtils.java b/arduino-core/src/cc/arduino/os/linux/LinuxFileNativeUtils.java
index 818da7a48..c519ce88f 100644
--- a/arduino-core/src/cc/arduino/os/linux/LinuxFileNativeUtils.java
+++ b/arduino-core/src/cc/arduino/os/linux/LinuxFileNativeUtils.java
@@ -37,20 +37,23 @@ public class LinuxFileNativeUtils {
public static void chmod(File file, int mode) throws IOException {
int res = libc.chmod(file.getAbsolutePath(), mode);
- if (res == -1)
+ if (res == -1) {
throw new IOException("Could not change file permission: " + strerror());
+ }
}
- public static void link(File file, File link) throws IOException {
- int res = libc.link(file.getAbsolutePath(), link.getAbsolutePath());
- if (res == -1)
- throw new IOException("Could not create hard link to " + file + " from " + link + ": " + strerror());
+ public static void link(File something, File somewhere) throws IOException {
+ int res = libc.link(something.getAbsolutePath(), somewhere.getAbsolutePath());
+ if (res == -1) {
+ throw new IOException("Could not create hard link to " + somewhere + " from " + something + ": " + strerror());
+ }
}
- public static void symlink(File file, File link) throws IOException {
- int res = libc.symlink(file.getPath(), link.getAbsolutePath());
- if (res == -1)
- throw new IOException("Could not create symlink: " + strerror());
+ public static void symlink(File something, File somewhere) throws IOException {
+ int res = libc.symlink(something.getPath(), somewhere.getAbsolutePath());
+ if (res == -1) {
+ throw new IOException("Could not create symlink to " + somewhere + " from " + something + ": " + strerror());
+ }
}
private static String strerror() {
diff --git a/arduino-core/src/cc/arduino/utils/ArchiveExtractor.java b/arduino-core/src/cc/arduino/utils/ArchiveExtractor.java
index dfcedc700..c3b6551f4 100644
--- a/arduino-core/src/cc/arduino/utils/ArchiveExtractor.java
+++ b/arduino-core/src/cc/arduino/utils/ArchiveExtractor.java
@@ -174,21 +174,23 @@ public class ArchiveExtractor {
}
File outputFile = new File(destFolder, name);
- File outputLinkFile = null;
+ File outputLinkedFile = null;
if (isLink) {
if (!linkName.startsWith(pathPrefix)) {
throw new IOException("Invalid archive: it must contains a single root folder while file " + linkName + " is outside " + pathPrefix);
}
linkName = linkName.substring(pathPrefix.length());
- outputLinkFile = new File(destFolder, linkName);
+ outputLinkedFile = new File(destFolder, linkName);
}
if (isSymLink) {
// Symbolic links are referenced with relative paths
- outputLinkFile = new File(linkName);
- if (outputLinkFile.isAbsolute()) {
- System.err.println(I18n.format(_("Warning: file {0} links to an absolute path {1}, changing it to {2}"), outputFile, outputLinkFile, new File(outputLinkFile.getName())));
+ outputLinkedFile = new File(linkName);
+ if (outputLinkedFile.isAbsolute()) {
+ System.err.println(I18n.format(_("Warning: file {0} links to an absolute path {1}, changing it to {2}"), outputFile, outputLinkedFile, new File(outputLinkedFile.getName())));
System.err.println();
- outputLinkFile = new File(outputLinkFile.getName());
+ outputLinkedFile = new File(outputLinkedFile.getName());
+ } else {
+ outputLinkedFile = new File(outputFile.getParent(), linkName);
}
}
@@ -213,10 +215,10 @@ public class ArchiveExtractor {
}
foldersTimestamps.put(outputFile, modifiedTime);
} else if (isLink) {
- hardLinks.put(outputLinkFile, outputFile);
+ hardLinks.put(outputFile, outputLinkedFile);
hardLinksMode.put(outputFile, mode);
} else if (isSymLink) {
- symLinks.put(outputLinkFile, outputFile);
+ symLinks.put(outputFile, outputLinkedFile);
symLinksModifiedTimes.put(outputFile, modifiedTime);
} else {
// Create the containing folder if not exists
@@ -234,16 +236,16 @@ public class ArchiveExtractor {
}
for (Map.Entry entry : hardLinks.entrySet()) {
- FileNativeUtils.link(entry.getKey(), entry.getValue());
- Integer mode = hardLinksMode.get(entry.getValue());
+ FileNativeUtils.link(entry.getValue(), entry.getKey());
+ Integer mode = hardLinksMode.get(entry.getKey());
if (mode != null) {
- FileNativeUtils.chmod(entry.getValue(), mode);
+ FileNativeUtils.chmod(entry.getKey(), mode);
}
}
for (Map.Entry entry : symLinks.entrySet()) {
- FileNativeUtils.symlink(entry.getKey(), entry.getValue());
- entry.getValue().setLastModified(symLinksModifiedTimes.get(entry.getValue()));
+ FileNativeUtils.symlink(entry.getValue(), entry.getKey());
+ entry.getKey().setLastModified(symLinksModifiedTimes.get(entry.getKey()));
}
} finally {