Skip to content

Commit eff742c

Browse files
committed
Initialize Editor only in GUI mode (part 1/3).
Move the initialization of Editor into the GUI section of the big if-then-elseif chain. This actually breaks cases for Verify and Upload that uses Editor to access core functions. This will be fixed in next commits.
1 parent b012846 commit eff742c

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

app/src/processing/app/Base.java

+29-29
Original file line numberDiff line numberDiff line change
@@ -264,35 +264,6 @@ public Base(String[] args) throws Exception {
264264

265265
parser.parseArgumentsPhase2();
266266

267-
for (String path : parser.getFilenames()) {
268-
// Correctly resolve relative paths
269-
File file = absoluteFile(path);
270-
271-
// Fix a problem with systems that use a non-ASCII languages. Paths are
272-
// being passed in with 8.3 syntax, which makes the sketch loader code
273-
// unhappy, since the sketch folder naming doesn't match up correctly.
274-
// http://dev.processing.org/bugs/show_bug.cgi?id=1089
275-
if (OSUtils.isWindows()) {
276-
try {
277-
file = file.getCanonicalFile();
278-
} catch (IOException e) {
279-
e.printStackTrace();
280-
}
281-
}
282-
283-
boolean showEditor = parser.isGuiMode();
284-
if (!parser.isForceSavePrefs())
285-
PreferencesData.setDoSave(showEditor);
286-
if (handleOpen(file, retrieveSketchLocation(".default"), showEditor, false) == null) {
287-
String mess = I18n.format(tr("Failed to open sketch: \"{0}\""), path);
288-
// Open failure is fatal in upload/verify mode
289-
if (parser.isVerifyOrUploadMode())
290-
showError(null, mess, 2);
291-
else
292-
showWarning(null, mess, null);
293-
}
294-
}
295-
296267
// Save the preferences. For GUI mode, this happens in the quit
297268
// handler, but for other modes we should also make sure to save
298269
// them.
@@ -408,6 +379,35 @@ public Base(String[] args) throws Exception {
408379
} else if (parser.isGuiMode()) {
409380
splash.splashText(tr("Starting..."));
410381

382+
for (String path : parser.getFilenames()) {
383+
// Correctly resolve relative paths
384+
File file = absoluteFile(path);
385+
386+
// Fix a problem with systems that use a non-ASCII languages. Paths are
387+
// being passed in with 8.3 syntax, which makes the sketch loader code
388+
// unhappy, since the sketch folder naming doesn't match up correctly.
389+
// http://dev.processing.org/bugs/show_bug.cgi?id=1089
390+
if (OSUtils.isWindows()) {
391+
try {
392+
file = file.getCanonicalFile();
393+
} catch (IOException e) {
394+
e.printStackTrace();
395+
}
396+
}
397+
398+
boolean showEditor = parser.isGuiMode();
399+
if (!parser.isForceSavePrefs())
400+
PreferencesData.setDoSave(showEditor);
401+
if (handleOpen(file, retrieveSketchLocation(".default"), showEditor, false) == null) {
402+
String mess = I18n.format(tr("Failed to open sketch: \"{0}\""), path);
403+
// Open failure is fatal in upload/verify mode
404+
if (parser.isVerifyOrUploadMode())
405+
showError(null, mess, 2);
406+
else
407+
showWarning(null, mess, null);
408+
}
409+
}
410+
411411
installKeyboardInputMap();
412412

413413
// Check if there were previously opened sketches to be restored

0 commit comments

Comments
 (0)