/** * Restore all the properties to their initial default. This may not change properties that are * currently active or that are read at initialization. These changes will take effect at the next * restart. */ public static synchronized void resetDefaultProperties() { BoardSetup setup = BoardSetup.getSetup(); setup.resetProperties(); for (Map.Entry<String, BoardProperties> ent : loaded_properties.entrySet()) { String id = ent.getKey(); if (id.equals("System")) continue; BoardProperties bp = ent.getValue(); bp.clear(); bp.loadProperties(id); } }
/** * Return an input stream for a library file with the given name. If no such file/resource exists, * returns null. */ public static InputStream getLibraryFile(String name) { // allow user version in ~/.bubbles String pname = name.replace("/", File.separator); File dir0 = new File(prop_base); if (dir0.exists()) { File f3 = new File(dir0, pname); if (f3.exists() && f3.canRead()) { try { return new FileInputStream(f3); } catch (IOException e) { } } } BoardProperties sp = getProperties("System"); String dir = sp.getProperty(BOARD_PROP_INSTALL_DIR); URL url = BoardProperties.class.getClassLoader().getResource(BOARD_RESOURCE_CHECK); // use jar version if available if (url != null) { String nm = "lib/" + name; InputStream ins = BoardProperties.class.getClassLoader().getResourceAsStream(nm); if (ins != null) return ins; dir = sp.getProperty(BOARD_PROP_JAR_DIR); } // use whats in the lib directory File f1 = new File(dir); File f2 = new File(f1, "lib"); File f3 = new File(f2, pname); try { return new FileInputStream(f3); } catch (IOException e) { } return null; }