MCPcopy Create free account
hub / github.com/akeranen/the-one / init

Method init

core/Settings.java:250–281  ·  view source on GitHub ↗

Initializes the settings all Settings objects will use. This should be called before any setting requests. Subsequent calls replace all old settings and then Settings contains only the new settings. The file #DEF_SETTINGS_FILE, if exists, is always read. @param propFile Path to the property

(String propFile)

Source from the content-addressed store, hash-verified

248 * @throws SettingsError If loading the settings file(s) didn't succeed
249 */
250 public static void init(String propFile) throws SettingsError {
251 String outFile;
252 try {
253 if (new File(DEF_SETTINGS_FILE).exists()) {
254 Properties defProperties = new Properties();
255 defProperties.load(new FileInputStream(DEF_SETTINGS_FILE));
256 props = new Properties(defProperties);
257 }
258 else {
259 props = new Properties();
260 }
261 if (propFile != null) {
262 props.load(new FileInputStream(propFile));
263 }
264 } catch (IOException e) {
265 throw new SettingsError(e);
266 }
267
268 outFile = props.getProperty(SETTING_OUTPUT_S);
269 if (outFile != null) {
270 if (outFile.trim().length() == 0) {
271 out = System.out;
272 } else {
273 try {
274 out = new PrintStream(new File(outFile));
275 } catch (FileNotFoundException e) {
276 throw new SettingsError("Can't open Settings output file:" +
277 e);
278 }
279 }
280 }
281 }
282
283 /**
284 * Reads another settings file and adds the key-value pairs to the current

Callers 7

initSettingsMethod · 0.95
getSettingMethod · 0.95
setUpMethod · 0.95
setUpWithMethod · 0.95
setupMapDataMethod · 0.95
writeToFileMethod · 0.95
setRouterMethod · 0.45

Calls 1

getPropertyMethod · 0.45

Tested by 4

setUpMethod · 0.76
setUpWithMethod · 0.76
setupMapDataMethod · 0.76
writeToFileMethod · 0.76