mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-18 12:54:25 +01:00
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.
This commit is contained in:
parent
4ba80e3715
commit
400ae7fdfd
@ -325,6 +325,8 @@ public class Base {
|
|||||||
String selectBoard = null;
|
String selectBoard = null;
|
||||||
String selectPort = null;
|
String selectPort = null;
|
||||||
String currentDirectory = System.getProperty("user.dir");
|
String currentDirectory = System.getProperty("user.dir");
|
||||||
|
List<String> filenames = new LinkedList<String>();
|
||||||
|
|
||||||
// Check if any files were passed in on the command line
|
// Check if any files were passed in on the command line
|
||||||
for (int i = 0; i < args.length; i++) {
|
for (int i = 0; i < args.length; i++) {
|
||||||
if (args[i].equals("--upload")) {
|
if (args[i].equals("--upload")) {
|
||||||
@ -360,14 +362,17 @@ public class Base {
|
|||||||
if (args[i].startsWith("--"))
|
if (args[i].startsWith("--"))
|
||||||
showError(null, I18n.format(_("unknown option: {0}"), args[i]), null);
|
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
|
// 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
|
// being passed in with 8.3 syntax, which makes the sketch loader code
|
||||||
// unhappy, since the sketch folder naming doesn't match up correctly.
|
// unhappy, since the sketch folder naming doesn't match up correctly.
|
||||||
// http://dev.processing.org/bugs/show_bug.cgi?id=1089
|
// http://dev.processing.org/bugs/show_bug.cgi?id=1089
|
||||||
if (isWindows()) {
|
if (isWindows()) {
|
||||||
try {
|
try {
|
||||||
File file = new File(args[i]);
|
File file = new File(path);
|
||||||
path = file.getCanonicalPath();
|
path = file.getCanonicalPath();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user