MCPcopy
hub / github.com/arduino/Arduino / load

Method load

app/src/processing/app/Theme.java:281–308  ·  view source on GitHub ↗

Attempts to parse the supplied zip file as a theme file. This is largely determined by the file being readable and containing a theme.txt entry. Returns null if the file is unreadable or doesn't contain theme.txt

(String namespace, File file)

Source from the content-addressed store, hash-verified

279 * Returns null if the file is unreadable or doesn't contain theme.txt
280 */
281 static ZippedTheme load(String namespace, File file) {
282 ZipFile zip = null;
283 try {
284 zip = new ZipFile(file);
285 ZipEntry themeTxtEntry = zip.getEntry(THEME_FILE_NAME);
286 if (themeTxtEntry != null) {
287 String name = file.getName().substring(0, file.getName().length() - 4);
288 String version = "";
289
290 ZipEntry themePropsEntry = zip.getEntry("theme.properties");
291 if (themePropsEntry != null) {
292 Properties themeProperties = new Properties();
293 themeProperties.load(zip.getInputStream(themePropsEntry));
294
295 name = themeProperties.getProperty("name", name);
296 version = themeProperties.getProperty("version", version);
297 }
298
299 return new ZippedTheme(namespace, file, zip, name, version);
300 }
301 } catch (Exception ex) {
302 System.err.println(format(tr("Error loading theme {0}: {1}"),
303 file.getAbsolutePath(), ex.getMessage()));
304 IOUtils.closeQuietly(zip);
305 }
306
307 return null;
308 }
309
310 }
311

Callers 6

loadLibMethod · 0.45
loadFromResourceMethod · 0.45
EditorTabMethod · 0.45
reloadMethod · 0.45
setThemeMethod · 0.45

Calls 5

getInputStreamMethod · 0.80
trMethod · 0.80
getNameMethod · 0.65
formatMethod · 0.45
getMessageMethod · 0.45

Tested by

no test coverage detected