From 85ae80b6f9ddc086f59aa126e30b63bbccbc5ff8 Mon Sep 17 00:00:00 2001 From: Federico Fissore Date: Fri, 26 Jun 2015 08:57:51 +0200 Subject: [PATCH] Introducing APP_DIR property. Allows the IDE to know its installation folder. Also upgrading appbundler with a patched version: https://bitbucket.org/ffissore/appbundler It allows to know the current working directory These two put together, we can now rely on APP_DIR when loading IDE resources while being sure current working directory is properly set, thus being much more friendly when run from CLI Fixes #1493 --- .gitignore | 4 +- .../src/processing/app/BaseNoGui.java | 17 +----- build/build.xml | 17 +++--- build/linux/dist/arduino | 3 +- .../appbundler-1.0ea-arduino3.jar.zip.sha | 1 + .../appbundler-1.0ea-upstream1.jar.zip.sha | 1 - build/windows/launcher/config.xml | 54 +++++++++---------- build/windows/launcher/config_debug.xml | 52 +++++++++--------- 8 files changed, 70 insertions(+), 79 deletions(-) create mode 100644 build/macosx/appbundler-1.0ea-arduino3.jar.zip.sha delete mode 100644 build/macosx/appbundler-1.0ea-upstream1.jar.zip.sha diff --git a/.gitignore b/.gitignore index 10d6d8a92..1daa455e4 100644 --- a/.gitignore +++ b/.gitignore @@ -33,8 +33,8 @@ build/macosx/libastylej* build/macosx/appbundler*.jar build/macosx/appbundler*.zip build/macosx/appbundler -build/macosx/appbundler-1.0ea-arduino2 -build/macosx/appbundler-1.0ea-upstream1 +build/macosx/appbundler-1.0ea-arduino*.zip +build/macosx/appbundler-1.0ea-upstream*.zip build/linux/work/ build/linux/dist/*.tar.gz build/linux/dist/*.tar.bz2 diff --git a/arduino-core/src/processing/app/BaseNoGui.java b/arduino-core/src/processing/app/BaseNoGui.java index 8aeffcc15..923123299 100644 --- a/arduino-core/src/processing/app/BaseNoGui.java +++ b/arduino-core/src/processing/app/BaseNoGui.java @@ -186,21 +186,8 @@ public class BaseNoGui { } static public File getContentFile(String name) { - File path = new File(System.getProperty("user.dir")); - - if (OSUtils.isMacOS()) { - if (System.getProperty("WORK_DIR") != null) { - path = new File(System.getProperty("WORK_DIR")); - } else { - try { - path = new File(BaseNoGui.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath()).getParentFile(); - } catch (URISyntaxException e) { - throw new RuntimeException(e); - } - } - } - - return new File(path, name); + File installationFolder = new File(System.getProperty("APP_DIR")); + return new File(installationFolder, name); } static public TargetPlatform getCurrentTargetPlatformFromPackage(String pack) { diff --git a/build/build.xml b/build/build.xml index d4b54fb22..2adb126dc 100644 --- a/build/build.xml +++ b/build/build.xml @@ -305,16 +305,17 @@ - - - - + + + + - + @@ -336,11 +338,12 @@ -