MCPcopy Index your code
hub / github.com/benfry/processing4 / createAndShowGUI

Method createAndShowGUI

app/src/processing/app/Base.java:166–314  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

164
165
166 static private void createAndShowGUI(String[] args) {
167 // these times are fairly negligible relative to Base.<init>
168// long t1 = System.currentTimeMillis();
169
170 File versionFile = Platform.getContentFile("lib/version.txt");
171 if (versionFile != null && versionFile.exists()) {
172 String[] lines = PApplet.loadStrings(versionFile);
173 if (lines != null && lines.length > 0) {
174 if (!VERSION_NAME.equals(lines[0])) {
175 VERSION_NAME = lines[0];
176 }
177 }
178 }
179
180 // Detect settings.txt in the lib folder for portable versions
181 File settingsFile = Platform.getContentFile("lib/settings.txt");
182 if (settingsFile != null && settingsFile.exists()) {
183 try {
184 Settings portable = new Settings(settingsFile);
185 String path = portable.get("settings.path");
186 File folder = new File(path);
187 boolean success = true;
188 if (!folder.exists()) {
189 success = folder.mkdirs();
190 if (!success) {
191 Messages.err("Could not create " + folder + " to store settings.");
192 }
193 }
194 if (success) {
195 if (!folder.canRead()) {
196 Messages.err("Cannot read from " + folder);
197 } else if (!folder.canWrite()) {
198 Messages.err("Cannot write to " + folder);
199 } else {
200 settingsOverride = folder.getAbsoluteFile();
201 }
202 }
203 } catch (IOException e) {
204 Messages.err("Error while reading the settings.txt file", e);
205 }
206 }
207
208 Platform.init();
209 // call after Platform.init() because we need the settings folder
210 Console.startup();
211
212 // Set the debug flag based on a file being present in the settings folder
213 File debugFile = getSettingsFile("debug");
214
215 // If it's a directory, it's a leftover from much older releases
216 // (2.x? 3.x?) that wrote DebugMode.log files into this directory.
217 // Could remove the directory, but it's harmless enough that it's
218 // not worth deleting files in case something could go wrong.
219 if (debugFile.exists() && debugFile.isFile()) {
220 DEBUG = true;
221 }
222
223 // Use native popups to avoid looking crappy on macOS

Callers 1

mainMethod · 0.95

Calls 15

getContentFileMethod · 0.95
loadStringsMethod · 0.95
getMethod · 0.95
errMethod · 0.95
initMethod · 0.95
startupMethod · 0.95
getSettingsFileMethod · 0.95
initMethod · 0.95
initMethod · 0.95
alreadyRunningMethod · 0.95
setLookAndFeelMethod · 0.95
setInterfaceZoomMethod · 0.95

Tested by

no test coverage detected