Skip to content

Introducing APP_DIR property #3421

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 29, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 2 additions & 20 deletions arduino-core/src/processing/app/BaseNoGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,21 +186,8 @@ static public PreferencesMap getBoardPreferences() {
}

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) {
Expand Down Expand Up @@ -976,11 +963,6 @@ static public void initParameters(String args[]) throws IOException {
preferencesFile = args[i];
continue;
}
if (args[i].equals("--curdir")) {
i++;
currentDirectory = args[i];
continue;
}
}

// run static initialization that grabs all the prefs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,8 @@ public void parseArgumentsPhase1() {
continue;
}
if (args[i].equals("--curdir")) {
i++;
if (i >= args.length)
BaseNoGui.showError(null, _("Argument required for --curdir"), 3);
// Argument should be already processed by Base.main(...)
continue;
BaseNoGui.showError(null, _("--curdir no longer supported"), 3);
return;
}
if (args[i].equals("--buildpath")) {
i++;
Expand Down
17 changes: 10 additions & 7 deletions build/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -305,16 +305,17 @@
<mkdir dir="${staging_folder}/work" />

<antcall target="unzip">
<param name="archive_file" value="${staging_folder}/appbundler-1.0ea-upstream1.jar.zip" />
<param name="archive_url" value="http://downloads.arduino.cc/appbundler-1.0ea-upstream1.jar.zip" />
<param name="final_folder" value="${staging_folder}/appbundler-1.0ea-upstream1" />
<param name="dest_folder" value="${staging_folder}/appbundler-1.0ea-upstream1" />
<param name="archive_file" value="${staging_folder}/appbundler-1.0ea-arduino3.jar.zip" />
<param name="archive_url" value="http://downloads.arduino.cc/appbundler-1.0ea-arduino3.jar.zip" />
<param name="final_folder" value="${staging_folder}/appbundler-1.0ea-arduino3" />
<param name="dest_folder" value="${staging_folder}/appbundler-1.0ea-arduino3" />
</antcall>

<taskdef name="bundleapp" classname="com.oracle.appbundler.AppBundlerTask" classpath="${staging_folder}/appbundler-1.0ea-upstream1/appbundler-1.0ea-upstream1.jar"/>
<taskdef name="bundleapp" classname="com.oracle.appbundler.AppBundlerTask" classpath="${staging_folder}/appbundler-1.0ea-arduino3/appbundler-1.0ea-arduino3.jar"/>

<bundleapp
jvmRequired="1.8"
jrepreferred="true"
outputdirectory="${staging_folder}/work"
name="Arduino"
displayname="Arduino"
Expand All @@ -326,6 +327,7 @@
icon="macosx/template.app/Contents/Resources/processing.icns"
mainclassname="processing.app.Base"
copyright="Arduino LLC"
applicationCategory="public.app-category.education"
minimumsystemversion="10.7"
highresolutioncapable="true">

Expand All @@ -336,11 +338,12 @@

<classpath refid="runtime.jars"/>

<option value="-Dapple.awt.application.name=Arduino" />
<option value="-Dapple.awt.application.name=Arduino"/>
<option value="-Dapple.laf.useScreenMenuBar=true"/>
<option value="-Dcom.apple.macos.use-file-dialog-packages=true"/>
<option value="-Dcom.apple.smallTabs=true"/>
<option value="-Dcom.apple.macos.useScreenMenuBar=true" />
<option value="-Dcom.apple.macos.useScreenMenuBar=true"/>
<option value="-DAPP_DIR=$APP_ROOT/Contents/Java"/>

<!--
<option value="-Dapple.awt.showGrowBox=false"/>
Expand Down
3 changes: 2 additions & 1 deletion build/linux/dist/arduino
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ if [ -x ./java/bin/java ]; then
JAVA=./java/bin/java
fi

$JAVA -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel $SPLASH processing.app.Base --curdir "$CURDIR" "$@"
$JAVA -DAPP_DIR="$APPDIR" -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel $SPLASH processing.app.Base --curdir "$CURDIR" "$@"

1 change: 1 addition & 0 deletions build/macosx/appbundler-1.0ea-arduino3.jar.zip.sha
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
247d19a71672171ce2eda25704121375f04c5e1f
1 change: 0 additions & 1 deletion build/macosx/appbundler-1.0ea-upstream1.jar.zip.sha

This file was deleted.

55 changes: 27 additions & 28 deletions build/windows/launcher/config.xml
Original file line number Diff line number Diff line change
@@ -1,45 +1,44 @@
<launch4jConfig>
<dontWrapJar>true</dontWrapJar>
<headerType>gui</headerType>
<jar>lib</jar>
<outfile>arduino.exe</outfile>
<chdir>.</chdir>
<errTitle>Arduino</errTitle>
<downloadUrl>http://www.oracle.com/technetwork/java/javase/downloads/index.html</downloadUrl>
<icon>application.ico</icon>
<classPath>
<mainClass>processing.app.Base</mainClass>
<cp>lib/antlr.jar</cp>
<cp>lib/apple.jar</cp>
<cp>lib/arduino-core.jar</cp>
<cp>lib/bcpg-jdk15on-152.jar</cp>
<cp>lib/bcprov-jdk15on-152.jar</cp>
<cp>lib/commons-codec-1.7.jar</cp>
<cp>lib/commons-compress-1.8.jar</cp>
<cp>lib/commons-exec-1.1.jar</cp>
<cp>lib/commons-httpclient-3.1.jar</cp>
<cp>lib/commons-lang3-3.3.2.jar</cp>
<cp>lib/commons-logging-1.0.4.jar</cp>
<cp>lib/ecj.jar</cp>
<cp>lib/guava-18.0.jar</cp>
<cp>lib/jackson-annotations-2.2.3.jar</cp>
<cp>lib/jackson-core-2.2.3.jar</cp>
<cp>lib/jackson-databind-2.2.3.jar</cp>
<cp>lib/jackson-module-mrbean-2.2.3.jar</cp>
<cp>lib/java-semver-0.8.0.jar</cp>
<cp>lib/jmdns-3.4.1.jar</cp>
<cp>lib/jna-4.1.0.jar</cp>
<cp>lib/jna-platform-4.1.0.jar</cp>
<cp>lib/jsch-0.1.50.jar</cp>
<cp>lib/jssc-2.8.0.jar</cp>
<cp>lib/pde.jar</cp>
<cp>lib/rsyntaxtextarea-2.5.6.1+arduino.jar</cp>
<cp>%EXEDIR%/lib/antlr.jar</cp>
<cp>%EXEDIR%/lib/apple.jar</cp>
<cp>%EXEDIR%/lib/arduino-core.jar</cp>
<cp>%EXEDIR%/lib/bcpg-jdk15on-152.jar</cp>
<cp>%EXEDIR%/lib/bcprov-jdk15on-152.jar</cp>
<cp>%EXEDIR%/lib/commons-codec-1.7.jar</cp>
<cp>%EXEDIR%/lib/commons-compress-1.8.jar</cp>
<cp>%EXEDIR%/lib/commons-exec-1.1.jar</cp>
<cp>%EXEDIR%/lib/commons-httpclient-3.1.jar</cp>
<cp>%EXEDIR%/lib/commons-lang3-3.3.2.jar</cp>
<cp>%EXEDIR%/lib/commons-logging-1.0.4.jar</cp>
<cp>%EXEDIR%/lib/ecj.jar</cp>
<cp>%EXEDIR%/lib/guava-18.0.jar</cp>
<cp>%EXEDIR%/lib/jackson-annotations-2.2.3.jar</cp>
<cp>%EXEDIR%/lib/jackson-core-2.2.3.jar</cp>
<cp>%EXEDIR%/lib/jackson-databind-2.2.3.jar</cp>
<cp>%EXEDIR%/lib/jackson-module-mrbean-2.2.3.jar</cp>
<cp>%EXEDIR%/lib/java-semver-0.8.0.jar</cp>
<cp>%EXEDIR%/lib/jmdns-3.4.1.jar</cp>
<cp>%EXEDIR%/lib/jna-4.1.0.jar</cp>
<cp>%EXEDIR%/lib/jna-platform-4.1.0.jar</cp>
<cp>%EXEDIR%/lib/jsch-0.1.50.jar</cp>
<cp>%EXEDIR%/lib/jssc-2.8.0.jar</cp>
<cp>%EXEDIR%/lib/pde.jar</cp>
<cp>%EXEDIR%/lib/rsyntaxtextarea-2.5.6.1+arduino.jar</cp>
</classPath>
<jre>
<path>java</path>
<runtimeBits>32</runtimeBits>
<opt>-splash:./lib/splash.png</opt>
<opt>-splash:"%EXEDIR%/lib/splash.png"</opt>
<opt>-Dsun.java2d.d3d=false</opt>
<opt>-DAPP_DIR="%EXEDIR%"</opt>
</jre>
<versionInfo>
<fileDescription>Arduino IDE</fileDescription>
Expand Down
53 changes: 26 additions & 27 deletions build/windows/launcher/config_debug.xml
Original file line number Diff line number Diff line change
@@ -1,44 +1,43 @@
<launch4jConfig>
<dontWrapJar>true</dontWrapJar>
<headerType>console</headerType>
<jar>lib</jar>
<outfile>arduino_debug.exe</outfile>
<chdir>.</chdir>
<errTitle>Arduino</errTitle>
<downloadUrl>http://www.oracle.com/technetwork/java/javase/downloads/index.html</downloadUrl>
<icon>application.ico</icon>
<classPath>
<mainClass>processing.app.Base</mainClass>
<cp>lib/antlr.jar</cp>
<cp>lib/apple.jar</cp>
<cp>lib/arduino-core.jar</cp>
<cp>lib/bcpg-jdk15on-152.jar</cp>
<cp>lib/bcprov-jdk15on-152.jar</cp>
<cp>lib/commons-codec-1.7.jar</cp>
<cp>lib/commons-compress-1.8.jar</cp>
<cp>lib/commons-exec-1.1.jar</cp>
<cp>lib/commons-httpclient-3.1.jar</cp>
<cp>lib/commons-lang3-3.3.2.jar</cp>
<cp>lib/commons-logging-1.0.4.jar</cp>
<cp>lib/ecj.jar</cp>
<cp>lib/guava-18.0.jar</cp>
<cp>lib/jackson-annotations-2.2.3.jar</cp>
<cp>lib/jackson-core-2.2.3.jar</cp>
<cp>lib/jackson-databind-2.2.3.jar</cp>
<cp>lib/jackson-module-mrbean-2.2.3.jar</cp>
<cp>lib/java-semver-0.8.0.jar</cp>
<cp>lib/jmdns-3.4.1.jar</cp>
<cp>lib/jna-4.1.0.jar</cp>
<cp>lib/jna-platform-4.1.0.jar</cp>
<cp>lib/jsch-0.1.50.jar</cp>
<cp>lib/jssc-2.8.0.jar</cp>
<cp>lib/pde.jar</cp>
<cp>lib/rsyntaxtextarea-2.5.6.1+arduino.jar</cp>
<cp>%EXEDIR%/lib/antlr.jar</cp>
<cp>%EXEDIR%/lib/apple.jar</cp>
<cp>%EXEDIR%/lib/arduino-core.jar</cp>
<cp>%EXEDIR%/lib/bcpg-jdk15on-152.jar</cp>
<cp>%EXEDIR%/lib/bcprov-jdk15on-152.jar</cp>
<cp>%EXEDIR%/lib/commons-codec-1.7.jar</cp>
<cp>%EXEDIR%/lib/commons-compress-1.8.jar</cp>
<cp>%EXEDIR%/lib/commons-exec-1.1.jar</cp>
<cp>%EXEDIR%/lib/commons-httpclient-3.1.jar</cp>
<cp>%EXEDIR%/lib/commons-lang3-3.3.2.jar</cp>
<cp>%EXEDIR%/lib/commons-logging-1.0.4.jar</cp>
<cp>%EXEDIR%/lib/ecj.jar</cp>
<cp>%EXEDIR%/lib/guava-18.0.jar</cp>
<cp>%EXEDIR%/lib/jackson-annotations-2.2.3.jar</cp>
<cp>%EXEDIR%/lib/jackson-core-2.2.3.jar</cp>
<cp>%EXEDIR%/lib/jackson-databind-2.2.3.jar</cp>
<cp>%EXEDIR%/lib/jackson-module-mrbean-2.2.3.jar</cp>
<cp>%EXEDIR%/lib/java-semver-0.8.0.jar</cp>
<cp>%EXEDIR%/lib/jmdns-3.4.1.jar</cp>
<cp>%EXEDIR%/lib/jna-4.1.0.jar</cp>
<cp>%EXEDIR%/lib/jna-platform-4.1.0.jar</cp>
<cp>%EXEDIR%/lib/jsch-0.1.50.jar</cp>
<cp>%EXEDIR%/lib/jssc-2.8.0.jar</cp>
<cp>%EXEDIR%/lib/pde.jar</cp>
<cp>%EXEDIR%/lib/rsyntaxtextarea-2.5.6.1+arduino.jar</cp>
</classPath>
<jre>
<path>java</path>
<runtimeBits>32</runtimeBits>
<opt>-Dsun.java2d.d3d=false</opt>
<opt>-DAPP_DIR="%EXEDIR%"</opt>
</jre>
<versionInfo>
<fileDescription>Arduino IDE</fileDescription>
Expand Down