mirror of
https://github.com/SKCraft/Launcher.git
synced 2025-02-17 01:51:24 +01:00
Added system property to load an additional launcher.properties.
This commit is contained in:
parent
0562764dee
commit
6c6f4a3062
@ -63,7 +63,8 @@ public final class Launcher {
|
||||
SharedLocale.loadBundle("com.skcraft.launcher.lang.Launcher", Locale.getDefault());
|
||||
|
||||
this.baseDir = baseDir;
|
||||
this.properties = LauncherUtils.loadProperties(Launcher.class, "launcher.properties");
|
||||
this.properties = LauncherUtils.loadProperties(Launcher.class,
|
||||
"launcher.properties", "com.skcraft.launcher.propertiesFile");
|
||||
this.instances = new InstanceList(this);
|
||||
this.assets = new AssetsRoot(new File(baseDir, "assets"));
|
||||
this.config = Persistence.load(new File(baseDir, "config.json"), Configuration.class);
|
||||
|
@ -37,15 +37,23 @@ public final class LauncherUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static Properties loadProperties(Class<?> clazz, String name) throws IOException {
|
||||
public static Properties loadProperties(Class<?> clazz, String name, String extraProperty) throws IOException {
|
||||
Closer closer = Closer.create();
|
||||
Properties prop = new Properties();
|
||||
try {
|
||||
InputStream in = closer.register(clazz.getResourceAsStream(name));
|
||||
prop.load(in);
|
||||
String extraPath = System.getProperty(extraProperty);
|
||||
if (extraPath != null) {
|
||||
log.info("Loading extra properties for " +
|
||||
clazz.getCanonicalName() + ":" + name + " from " + extraPath + "...");
|
||||
in = closer.register(new BufferedInputStream(closer.register(new FileInputStream(extraPath))));
|
||||
prop.load(in);
|
||||
}
|
||||
} finally {
|
||||
closer.close();
|
||||
}
|
||||
|
||||
return prop;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user