Skip to content

Commit 87bdaa8

Browse files
matthijskooijmancmaglie
authored andcommitted
Parse --curdir in Base.main()
This shouldn't change any behaviour, but prepares for upcoming changes.
1 parent cf4fb7d commit 87bdaa8

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

app/src/processing/app/Base.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ public class Base {
117117
// Location for untitled items
118118
static File untitledFolder;
119119

120+
// Current directory to use for relative paths specified on the
121+
// commandline
122+
static String currentDirectory = System.getProperty("user.dir");
123+
120124
// p5 icon for the window
121125
// static Image icon;
122126

@@ -150,6 +154,12 @@ static public void main(String args[]) throws Exception {
150154
if (args[i].equals("--preferences-file")) {
151155
++i;
152156
preferencesFile = new File(args[i]);
157+
continue;
158+
}
159+
if (args[i].equals("--curdir")) {
160+
i++;
161+
currentDirectory = args[i];
162+
continue;
153163
}
154164
}
155165

@@ -339,7 +349,6 @@ public Base(String[] args) throws Exception {
339349
String getPref = null;
340350
String selectBoard = null;
341351
String selectPort = null;
342-
String currentDirectory = System.getProperty("user.dir");
343352
List<String> filenames = new LinkedList<String>();
344353

345354
// Map of possible actions and corresponding options
@@ -398,7 +407,7 @@ public Base(String[] args) throws Exception {
398407
i++;
399408
if (i >= args.length)
400409
showError(null, _("Argument required for --curdir"), 3);
401-
currentDirectory = args[i];
410+
// Argument should be already processed by Base.main(...)
402411
continue;
403412
}
404413
if (args[i].equals("--pref")) {

0 commit comments

Comments
 (0)