Skip to content

Commit 400ae7f

Browse files
Slightly delay opening of files specified on the commandline
Instead of opening up files during argument processing, the filenames are now stored in a list and opened only after all commandline arguments have been processed. This commit in itself shouldn't change any behaviour, but it prepares for improved error reporting in the next commits.
1 parent 4ba80e3 commit 400ae7f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

app/src/processing/app/Base.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,8 @@ public Base(String[] args) throws Exception {
325325
String selectBoard = null;
326326
String selectPort = null;
327327
String currentDirectory = System.getProperty("user.dir");
328+
List<String> filenames = new LinkedList<String>();
329+
328330
// Check if any files were passed in on the command line
329331
for (int i = 0; i < args.length; i++) {
330332
if (args[i].equals("--upload")) {
@@ -360,14 +362,17 @@ public Base(String[] args) throws Exception {
360362
if (args[i].startsWith("--"))
361363
showError(null, I18n.format(_("unknown option: {0}"), args[i]), null);
362364

363-
String path = args[i];
365+
filenames.add(args[i]);
366+
}
367+
368+
for (String path: filenames) {
364369
// Fix a problem with systems that use a non-ASCII languages. Paths are
365370
// being passed in with 8.3 syntax, which makes the sketch loader code
366371
// unhappy, since the sketch folder naming doesn't match up correctly.
367372
// http://dev.processing.org/bugs/show_bug.cgi?id=1089
368373
if (isWindows()) {
369374
try {
370-
File file = new File(args[i]);
375+
File file = new File(path);
371376
path = file.getCanonicalPath();
372377
} catch (IOException e) {
373378
e.printStackTrace();

0 commit comments

Comments
 (0)