Commit b8f2dadef16c52ecc996105e426653efb128ffaa
1 parent
86bd548c
LiteLoader 1.6.4_02 - fixed missing config dir causing crash with new startup or…
…der, minor config changes
Showing
4 changed files
with
45 additions
and
18 deletions
java/com/mumfrey/liteloader/core/LiteLoader.java
| ... | ... | @@ -51,6 +51,10 @@ import com.mumfrey.liteloader.util.PrivateFields; |
| 51 | 51 | */ |
| 52 | 52 | public final class LiteLoader |
| 53 | 53 | { |
| 54 | + private static final String OPTION_MOD_INFO_SCREEN = "modInfoScreen"; | |
| 55 | + private static final String OPTION_SOUND_MANAGER_FIX = "soundManagerFix"; | |
| 56 | + private static final String OPTION_CONTROLS_PAGES = "controls.pages"; | |
| 57 | + | |
| 54 | 58 | /** |
| 55 | 59 | * LiteLoader is a singleton, this is the singleton instance |
| 56 | 60 | */ |
| ... | ... | @@ -314,9 +318,9 @@ public final class LiteLoader |
| 314 | 318 | catch (Exception ex) {} |
| 315 | 319 | } |
| 316 | 320 | |
| 317 | - this.paginateControls = this.bootstrap.getAndStoreBooleanProperty("controls.pages", true); | |
| 318 | - this.inhibitSoundManagerReload = this.bootstrap.getAndStoreBooleanProperty("soundManagerFix", true); | |
| 319 | - this.displayModInfoScreenTab = this.bootstrap.getAndStoreBooleanProperty("modInfoScreen", true); | |
| 321 | + this.paginateControls = this.bootstrap.getAndStoreBooleanProperty(OPTION_CONTROLS_PAGES, true); | |
| 322 | + this.inhibitSoundManagerReload = this.bootstrap.getAndStoreBooleanProperty(OPTION_SOUND_MANAGER_FIX, true); | |
| 323 | + this.displayModInfoScreenTab = this.bootstrap.getAndStoreBooleanProperty(OPTION_MOD_INFO_SCREEN, true); | |
| 320 | 324 | |
| 321 | 325 | this.enumerator.discoverModClasses(); |
| 322 | 326 | } |
| ... | ... | @@ -1034,7 +1038,7 @@ public final class LiteLoader |
| 1034 | 1038 | public void setDisplayModInfoScreenTab(boolean show) |
| 1035 | 1039 | { |
| 1036 | 1040 | this.displayModInfoScreenTab = show; |
| 1037 | - this.bootstrap.setBooleanProperty("modInfoScreen", show); | |
| 1041 | + this.bootstrap.setBooleanProperty(OPTION_MOD_INFO_SCREEN, show); | |
| 1038 | 1042 | this.bootstrap.writeProperties(); |
| 1039 | 1043 | } |
| 1040 | 1044 | ... | ... |
java/com/mumfrey/liteloader/core/LiteLoaderBootstrap.java
| ... | ... | @@ -123,6 +123,9 @@ class LiteLoaderBootstrap implements ILoaderBootstrap |
| 123 | 123 | this.configBaseFolder = new File(this.gameDirectory, "liteconfig"); |
| 124 | 124 | this.logFile = new File(this.configBaseFolder, "liteloader.log"); |
| 125 | 125 | this.propertiesFile = new File(this.configBaseFolder, "liteloader.properties"); |
| 126 | + | |
| 127 | + if (!this.modsFolder.exists()) this.modsFolder.mkdirs(); | |
| 128 | + if (!this.configBaseFolder.exists()) this.configBaseFolder.mkdirs(); | |
| 126 | 129 | } |
| 127 | 130 | |
| 128 | 131 | /* (non-Javadoc) |
| ... | ... | @@ -156,6 +159,9 @@ class LiteLoaderBootstrap implements ILoaderBootstrap |
| 156 | 159 | @Override |
| 157 | 160 | public void init(List<String> modsToLoad, LaunchClassLoader classLoader) |
| 158 | 161 | { |
| 162 | + // PreInit failed | |
| 163 | + if (this.enumerator == null) return; | |
| 164 | + | |
| 159 | 165 | try |
| 160 | 166 | { |
| 161 | 167 | if (LiteLoaderBootstrap.logger.getHandlers().length < 1) |
| ... | ... | @@ -173,6 +179,9 @@ class LiteLoaderBootstrap implements ILoaderBootstrap |
| 173 | 179 | @Override |
| 174 | 180 | public void postInit() |
| 175 | 181 | { |
| 182 | + // PreInit failed | |
| 183 | + if (this.enumerator == null) return; | |
| 184 | + | |
| 176 | 185 | try |
| 177 | 186 | { |
| 178 | 187 | if (LiteLoaderBootstrap.logger.getHandlers().length < 1) | ... | ... |
java/com/mumfrey/liteloader/core/LiteLoaderEnumerator.java
| ... | ... | @@ -43,6 +43,12 @@ import com.mumfrey.liteloader.launch.LiteLoaderTweaker; |
| 43 | 43 | */ |
| 44 | 44 | class LiteLoaderEnumerator implements FilenameFilter |
| 45 | 45 | { |
| 46 | + private static final String OPTION_SEARCH_ZIPFILES = "search.zipfiles"; | |
| 47 | + private static final String OPTION_SEARCH_JARFILES = "search.jarfiles"; | |
| 48 | + private static final String OPTION_SEARCH_MODS = "search.mods"; | |
| 49 | + private static final String OPTION_SEARCH_JAR = "search.jar"; | |
| 50 | + private static final String OPTION_SEARCH_CLASSPATH = "search.classpath"; | |
| 51 | + | |
| 46 | 52 | /** |
| 47 | 53 | * Maximum recursion depth for mod discovery |
| 48 | 54 | */ |
| ... | ... | @@ -111,6 +117,9 @@ class LiteLoaderEnumerator implements FilenameFilter |
| 111 | 117 | |
| 112 | 118 | // Read the discovery settings from the properties |
| 113 | 119 | this.readSettings(); |
| 120 | + | |
| 121 | + // Write settings back to the properties file, in case they changed | |
| 122 | + this.writeSettings(); | |
| 114 | 123 | } |
| 115 | 124 | |
| 116 | 125 | /** |
| ... | ... | @@ -176,13 +185,13 @@ class LiteLoaderEnumerator implements FilenameFilter |
| 176 | 185 | /** |
| 177 | 186 | * Get the discovery settings from the properties file |
| 178 | 187 | */ |
| 179 | - public void readSettings() | |
| 188 | + private void readSettings() | |
| 180 | 189 | { |
| 181 | - this.readZipFiles = this.bootstrap.getAndStoreBooleanProperty("search.zips", false); | |
| 182 | - this.readZipFiles = this.bootstrap.getAndStoreBooleanProperty("search.jars", true); | |
| 183 | - this.searchModsFolder = this.bootstrap.getAndStoreBooleanProperty("search.mods", true); | |
| 184 | - this.searchProtectionDomain = this.bootstrap.getAndStoreBooleanProperty("search.jar", true); | |
| 185 | - this.searchClassPath = this.bootstrap.getAndStoreBooleanProperty("search.classpath", true); | |
| 190 | + this.readZipFiles = this.bootstrap.getAndStoreBooleanProperty(OPTION_SEARCH_ZIPFILES, false); | |
| 191 | + this.readJarFiles = this.bootstrap.getAndStoreBooleanProperty(OPTION_SEARCH_JARFILES, true); | |
| 192 | + this.searchModsFolder = this.bootstrap.getAndStoreBooleanProperty(OPTION_SEARCH_MODS, true); | |
| 193 | + this.searchProtectionDomain = this.bootstrap.getAndStoreBooleanProperty(OPTION_SEARCH_JAR, true); | |
| 194 | + this.searchClassPath = this.bootstrap.getAndStoreBooleanProperty(OPTION_SEARCH_CLASSPATH, true); | |
| 186 | 195 | |
| 187 | 196 | if (!this.searchModsFolder && !this.searchProtectionDomain && !this.searchClassPath) |
| 188 | 197 | { |
| ... | ... | @@ -192,12 +201,18 @@ class LiteLoaderEnumerator implements FilenameFilter |
| 192 | 201 | this.searchProtectionDomain = true; |
| 193 | 202 | this.searchClassPath = true; |
| 194 | 203 | } |
| 195 | - | |
| 196 | - this.bootstrap.setBooleanProperty("search.zips", this.readZipFiles); | |
| 197 | - this.bootstrap.setBooleanProperty("search.jars", this.readJarFiles); | |
| 198 | - this.bootstrap.setBooleanProperty("search.mods", this.searchModsFolder); | |
| 199 | - this.bootstrap.setBooleanProperty("search.jar", this.searchProtectionDomain); | |
| 200 | - this.bootstrap.setBooleanProperty("search.classpath", this.searchClassPath); | |
| 204 | + } | |
| 205 | + | |
| 206 | + /** | |
| 207 | + * Write settings | |
| 208 | + */ | |
| 209 | + private void writeSettings() | |
| 210 | + { | |
| 211 | + this.bootstrap.setBooleanProperty(OPTION_SEARCH_ZIPFILES, this.readZipFiles); | |
| 212 | + this.bootstrap.setBooleanProperty(OPTION_SEARCH_JARFILES, this.readJarFiles); | |
| 213 | + this.bootstrap.setBooleanProperty(OPTION_SEARCH_MODS, this.searchModsFolder); | |
| 214 | + this.bootstrap.setBooleanProperty(OPTION_SEARCH_JAR, this.searchProtectionDomain); | |
| 215 | + this.bootstrap.setBooleanProperty(OPTION_SEARCH_CLASSPATH, this.searchClassPath); | |
| 201 | 216 | } |
| 202 | 217 | |
| 203 | 218 | /** | ... | ... |