Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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.
  • Loading branch information
cmaglie committed Nov 25, 2016
commit df1841f0cd323cb9adb618bfdb15a96dbec83b9c
58 changes: 29 additions & 29 deletions app/src/processing/app/Base.java
Original file line number Diff line number Diff line change
Expand Up @@ -264,35 +264,6 @@ public Base(String[] args) throws Exception {

parser.parseArgumentsPhase2();

for (String path : parser.getFilenames()) {
// Correctly resolve relative paths
File file = absoluteFile(path);

// 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 (OSUtils.isWindows()) {
try {
file = file.getCanonicalFile();
} catch (IOException e) {
e.printStackTrace();
}
}

boolean showEditor = parser.isGuiMode();
if (!parser.isForceSavePrefs())
PreferencesData.setDoSave(showEditor);
if (handleOpen(file, retrieveSketchLocation(".default"), showEditor, false) == null) {
String mess = I18n.format(tr("Failed to open sketch: \"{0}\""), path);
// Open failure is fatal in upload/verify mode
if (parser.isVerifyOrUploadMode())
showError(null, mess, 2);
else
showWarning(null, mess, null);
}
}

// Save the preferences. For GUI mode, this happens in the quit
// handler, but for other modes we should also make sure to save
// them.
Expand Down Expand Up @@ -408,6 +379,35 @@ public Base(String[] args) throws Exception {
} else if (parser.isGuiMode()) {
splash.splashText(tr("Starting..."));

for (String path : parser.getFilenames()) {
// Correctly resolve relative paths
File file = absoluteFile(path);

// 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 (OSUtils.isWindows()) {
try {
file = file.getCanonicalFile();
} catch (IOException e) {
e.printStackTrace();
}
}

boolean showEditor = parser.isGuiMode();
if (!parser.isForceSavePrefs())
PreferencesData.setDoSave(showEditor);
if (handleOpen(file, retrieveSketchLocation(".default"), showEditor, false) == null) {
String mess = I18n.format(tr("Failed to open sketch: \"{0}\""), path);
// Open failure is fatal in upload/verify mode
if (parser.isVerifyOrUploadMode())
showError(null, mess, 2);
else
showWarning(null, mess, null);
}
}

installKeyboardInputMap();

// Check if there were previously opened sketches to be restored
Expand Down