1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-18 07:52:14 +01:00

IDE command line: sketches can now be specified with relative paths. Fixes #1493

This commit is contained in:
Federico Fissore 2013-10-28 10:10:14 +01:00
parent 26ff527ad2
commit d133365cc1
2 changed files with 15 additions and 3 deletions

View File

@ -324,6 +324,7 @@ public class Base {
boolean doVerbose = false;
String selectBoard = null;
String selectPort = null;
String currentDirectory = System.getProperty("user.dir");
// Check if any files were passed in on the command line
for (int i = 0; i < args.length; i++) {
if (args[i].equals("--upload")) {
@ -350,6 +351,12 @@ public class Base {
selectPort = args[i];
continue;
}
if (args[i].equals("--curdir")) {
i++;
if (i < args.length)
currentDirectory = args[i];
continue;
}
String path = args[i];
// Fix a problem with systems that use a non-ASCII languages. Paths are
// being passed in with 8.3 syntax, which makes the sketch loader code
@ -363,6 +370,9 @@ public class Base {
e.printStackTrace();
}
}
if (!new File(path).exists()) {
path = new File(currentDirectory, path).getAbsolutePath();
}
if (handleOpen(path) != null) {
opened = true;
}

View File

@ -1,5 +1,6 @@
#!/bin/sh
CURDIR=`pwd`
APPDIR="$(dirname -- "$(readlink -f -- "${0}")" )"
cd "$APPDIR"
@ -19,4 +20,5 @@ export LD_LIBRARY_PATH
export PATH="${APPDIR}/java/bin:${PATH}"
java -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel processing.app.Base "$@"
java -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel processing.app.Base --curdir $CURDIR "$@"