From 400ae7fdfdfafe62025f6106595b85453ea9fe78 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Fri, 25 Oct 2013 15:27:41 +0200 Subject: [PATCH] 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. --- app/src/processing/app/Base.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index d6bbb89d9..05b173b2a 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -325,6 +325,8 @@ public class Base { String selectBoard = null; String selectPort = null; String currentDirectory = System.getProperty("user.dir"); + List filenames = new LinkedList(); + // Check if any files were passed in on the command line for (int i = 0; i < args.length; i++) { if (args[i].equals("--upload")) { @@ -360,14 +362,17 @@ public class Base { if (args[i].startsWith("--")) showError(null, I18n.format(_("unknown option: {0}"), args[i]), null); - String path = args[i]; + filenames.add(args[i]); + } + + for (String path: filenames) { // 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 // unhappy, since the sketch folder naming doesn't match up correctly. // http://dev.processing.org/bugs/show_bug.cgi?id=1089 if (isWindows()) { try { - File file = new File(args[i]); + File file = new File(path); path = file.getCanonicalPath(); } catch (IOException e) { e.printStackTrace();