Skip to content

Commit d133365

Browse files
author
Federico Fissore
committed
IDE command line: sketches can now be specified with relative paths. Fixes #1493
1 parent 26ff527 commit d133365

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

app/src/processing/app/Base.java

+10
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ public Base(String[] args) throws Exception {
324324
boolean doVerbose = false;
325325
String selectBoard = null;
326326
String selectPort = null;
327+
String currentDirectory = System.getProperty("user.dir");
327328
// Check if any files were passed in on the command line
328329
for (int i = 0; i < args.length; i++) {
329330
if (args[i].equals("--upload")) {
@@ -350,6 +351,12 @@ public Base(String[] args) throws Exception {
350351
selectPort = args[i];
351352
continue;
352353
}
354+
if (args[i].equals("--curdir")) {
355+
i++;
356+
if (i < args.length)
357+
currentDirectory = args[i];
358+
continue;
359+
}
353360
String path = args[i];
354361
// Fix a problem with systems that use a non-ASCII languages. Paths are
355362
// being passed in with 8.3 syntax, which makes the sketch loader code
@@ -363,6 +370,9 @@ public Base(String[] args) throws Exception {
363370
e.printStackTrace();
364371
}
365372
}
373+
if (!new File(path).exists()) {
374+
path = new File(currentDirectory, path).getAbsolutePath();
375+
}
366376
if (handleOpen(path) != null) {
367377
opened = true;
368378
}

build/linux/dist/arduino

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#!/bin/sh
2-
2+
3+
CURDIR=`pwd`
34
APPDIR="$(dirname -- "$(readlink -f -- "${0}")" )"
45

56
cd "$APPDIR"
6-
7+
78
for LIB in \
89
java/lib/rt.jar \
910
java/lib/tools.jar \
@@ -19,4 +20,5 @@ export LD_LIBRARY_PATH
1920

2021
export PATH="${APPDIR}/java/bin:${PATH}"
2122

22-
java -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel processing.app.Base "$@"
23+
java -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel processing.app.Base --curdir $CURDIR "$@"
24+

0 commit comments

Comments
 (0)