fix prompting no jar file when renaming version like Forge or LiteLoader version.

This commit is contained in:
huanghongxun 2015-07-24 07:52:20 +08:00
parent abb17dd05d
commit 538688c8f1
4 changed files with 40 additions and 37 deletions

View File

@ -111,7 +111,7 @@ task makeExecutable(dependsOn: jar) << {
is.close() is.close()
fos.close() fos.close()
} }
/*
launch4j { launch4j {
launch4jCmd = 'D:\\Develop\\Java\\Launch4j\\launch4j.exe' launch4jCmd = 'D:\\Develop\\Java\\Launch4j\\launch4j.exe'
supportUrl = 'http://www.mcbbs.net/thread-142335-1-1.html' supportUrl = 'http://www.mcbbs.net/thread-142335-1-1.html'
@ -126,7 +126,7 @@ launch4j {
jar = new File(project.buildDir, 'libs/' + mavenGroupId + '-' + mavenVersion + '.jar').absolutePath jar = new File(project.buildDir, 'libs/' + mavenGroupId + '-' + mavenVersion + '.jar').absolutePath
outfile = mavenGroupId + '-' + mavenVersion + '.exe' outfile = mavenGroupId + '-' + mavenVersion + '.exe'
messagesJreVersionError = 'This application requires a Java Runtime Environment installation, or the runtime is corrupted.\n\u6ca1\u6709\u627e\u5230\u004a\u0061\u0076\u0061\u8fd0\u884c\u65f6\uff0c\u8bf7\u4e0d\u8981\u4f7f\u7528\u7eff\u8272\u004a\u0061\u0076\u0061\uff0c\u8bf7\u4f7f\u7528\u5b89\u88c5\u7248\u7684\u004a\u0061\u0076\u0061\uff0c\u70b9\u51fb\u786e\u5b9a\u8fdb\u5165\u004a\u0061\u0076\u0061\u5b89\u88c5\u9875\u9762\u3002' messagesJreVersionError = 'This application requires a Java Runtime Environment installation, or the runtime is corrupted.\n\u6ca1\u6709\u627e\u5230\u004a\u0061\u0076\u0061\u8fd0\u884c\u65f6\uff0c\u8bf7\u4e0d\u8981\u4f7f\u7528\u7eff\u8272\u004a\u0061\u0076\u0061\uff0c\u8bf7\u4f7f\u7528\u5b89\u88c5\u7248\u7684\u004a\u0061\u0076\u0061\uff0c\u70b9\u51fb\u786e\u5b9a\u8fdb\u5165\u004a\u0061\u0076\u0061\u5b89\u88c5\u9875\u9762\u3002'
}*/ }
processResources { processResources {
from(sourceSets.main.resources.srcDirs) { from(sourceSets.main.resources.srcDirs) {
@ -134,5 +134,6 @@ processResources {
} }
} }
makeExecutable.dependsOn proguard build.dependsOn proguard
build.dependsOn makeExecutable //makeExecutable.dependsOn proguard
//build.dependsOn makeExecutable

View File

@ -1980,24 +1980,24 @@ org.jackhuang.hellominecraft.launcher.version.MinecraftVersionManager -> org.jac
78:78:int getVersionCount() -> a 78:78:int getVersionCount() -> a
83:160:void refreshVersions() -> a 83:160:void refreshVersions() -> a
164:168:boolean removeVersionFromDisk(java.lang.String) -> a 164:168:boolean removeVersionFromDisk(java.lang.String) -> a
174:187:boolean renameVersion(java.lang.String,java.lang.String) -> a 174:189:boolean renameVersion(java.lang.String,java.lang.String) -> a
193:193:boolean refreshJson(java.lang.String) -> b 195:195:boolean refreshJson(java.lang.String) -> b
198:200:boolean refreshAssetsIndex(java.lang.String) -> c 200:202:boolean refreshAssetsIndex(java.lang.String) -> c
205:210:boolean install(java.lang.String,org.jackhuang.hellominecraft.launcher.utils.download.DownloadType) -> a 207:212:boolean install(java.lang.String,org.jackhuang.hellominecraft.launcher.utils.download.DownloadType) -> a
215:219:java.io.File getRunDirectory(java.lang.String) -> a 217:221:java.io.File getRunDirectory(java.lang.String) -> a
225:240:java.util.List getDownloadLibraries(org.jackhuang.hellominecraft.launcher.utils.download.DownloadType) -> a 227:242:java.util.List getDownloadLibraries(org.jackhuang.hellominecraft.launcher.utils.download.DownloadType) -> a
245:246:void openSelf(java.lang.String) -> a 247:248:void openSelf(java.lang.String) -> a
250:251:void open(java.lang.String,java.lang.String) -> a 252:253:void open(java.lang.String,java.lang.String) -> a
255:255:java.io.File getAssets() -> a 257:257:java.io.File getAssets() -> a
260:270:org.jackhuang.hellominecraft.launcher.launch.GameLauncher$DecompressLibraryJob getDecompressLibraries() -> a 262:272:org.jackhuang.hellominecraft.launcher.launch.GameLauncher$DecompressLibraryJob getDecompressLibraries() -> a
275:276:java.io.File getDecompressNativesToLocation() -> c 277:278:java.io.File getDecompressNativesToLocation() -> c
281:281:java.io.File getMinecraftJar() -> d 283:283:java.io.File getMinecraftJar() -> d
287:287:org.jackhuang.hellominecraft.launcher.launch.IMinecraftLoader provideMinecraftLoader(org.jackhuang.hellominecraft.launcher.utils.auth.UserProfileProvider,org.jackhuang.hellominecraft.launcher.utils.download.DownloadType) -> a 289:289:org.jackhuang.hellominecraft.launcher.launch.IMinecraftLoader provideMinecraftLoader(org.jackhuang.hellominecraft.launcher.utils.auth.UserProfileProvider,org.jackhuang.hellominecraft.launcher.utils.download.DownloadType) -> a
292:292:org.jackhuang.hellominecraft.launcher.version.MinecraftVersion getOneVersion() -> a 294:294:org.jackhuang.hellominecraft.launcher.version.MinecraftVersion getOneVersion() -> a
297:297:org.jackhuang.hellominecraft.launcher.version.MinecraftVersion getVersionById(java.lang.String) -> a 299:299:org.jackhuang.hellominecraft.launcher.version.MinecraftVersion getVersionById(java.lang.String) -> a
302:302:java.io.File getResourcePacks() -> b 304:304:java.io.File getResourcePacks() -> b
307:307:java.io.File getBaseFolder() -> e 309:309:java.io.File getBaseFolder() -> e
312:314:void onLaunch() -> b 314:316:void onLaunch() -> b
org.jackhuang.hellominecraft.launcher.version.MinecraftVersionManager$1 -> org.jackhuang.hellominecraft.launcher.aN: org.jackhuang.hellominecraft.launcher.version.MinecraftVersionManager$1 -> org.jackhuang.hellominecraft.launcher.aN:
int[] $SwitchMap$org$jackhuang$hellominecraft$launcher$version$GameDirType -> a int[] $SwitchMap$org$jackhuang$hellominecraft$launcher$version$GameDirType -> a
org.jackhuang.hellominecraft.launcher.version.Natives -> org.jackhuang.hellominecraft.launcher.aO: org.jackhuang.hellominecraft.launcher.version.Natives -> org.jackhuang.hellominecraft.launcher.aO:

View File

@ -49,21 +49,8 @@ public final class Launcher {
} }
public static void main(String[] args) { public static void main(String[] args) {
println("*** " + Main.makeTitle() + " ***");
Thread.currentThread().setName("launcher"); Thread.currentThread().setName("launcher");
try { println("*** " + Main.makeTitle() + " ***");
File logFile = new File("hmclmc.log");
if (!logFile.exists()) logFile.createNewFile();
FileOutputStream tc = new FileOutputStream(logFile);
DoubleOutputStream out = new DoubleOutputStream(tc, System.out);
System.setOut(new LauncherPrintStream(out));
DoubleOutputStream err = new DoubleOutputStream(tc, System.err);
System.setErr(new LauncherPrintStream(err));
} catch (Exception e) {
println("Failed to add log file appender.");
e.printStackTrace();
}
LogWindow.instance.setTerminateGame(Utils::shutdownForcely); LogWindow.instance.setTerminateGame(Utils::shutdownForcely);
@ -85,6 +72,19 @@ public final class Launcher {
int len = tokenized.length; int len = tokenized.length;
if (showInfo) { if (showInfo) {
try {
File logFile = new File("hmclmc.log");
if (!logFile.exists()) logFile.createNewFile();
FileOutputStream tc = new FileOutputStream(logFile);
DoubleOutputStream out = new DoubleOutputStream(tc, System.out);
System.setOut(new LauncherPrintStream(out));
DoubleOutputStream err = new DoubleOutputStream(tc, System.err);
System.setErr(new LauncherPrintStream(err));
} catch (Exception e) {
println("Failed to add log file appender.");
e.printStackTrace();
}
println("Arguments: {\n" + StrUtils.parseParams(" ", args, "\n") + "\n}"); println("Arguments: {\n" + StrUtils.parseParams(" ", args, "\n") + "\n}");
println("Main Class: " + mainClass); println("Main Class: " + mainClass);
println("Class Path: {\n" + StrUtils.parseParams(" ", tokenized, "\n") + "\n}"); println("Class Path: {\n" + StrUtils.parseParams(" ", tokenized, "\n") + "\n}");

View File

@ -180,7 +180,9 @@ public final class MinecraftVersionManager extends IMinecraftProvider {
File toJson = new File(toDir, to + ".json"); File toJson = new File(toDir, to + ".json");
File toJar = new File(toDir, to + ".jar"); File toJar = new File(toDir, to + ".jar");
new File(toDir, from + ".json").renameTo(toJson); new File(toDir, from + ".json").renameTo(toJson);
new File(toDir, from + ".jar").renameTo(toJar); File newJar = new File(toDir, from + ".jar");
if (newJar.exists())
newJar.renameTo(toJar);
return true; return true;
} catch (IOException | JsonSyntaxException e) { } catch (IOException | JsonSyntaxException e) {
HMCLog.warn("Failed to rename " + from + " to " + to + ", the json of this Minecraft is malformed.", e); HMCLog.warn("Failed to rename " + from + " to " + to + ", the json of this Minecraft is malformed.", e);