1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-02-22 23:23:30 +01:00

Fixed update batch file to work in directories with spaces.

This commit is contained in:
rtsketo 2019-08-22 14:35:24 +03:00
parent 0150c5fa37
commit 28dc3f796f

View File

@ -23,7 +23,7 @@ import com.rarchives.ripme.utils.Utils;
public class UpdateUtils {
private static final Logger logger = Logger.getLogger(UpdateUtils.class);
private static final String DEFAULT_VERSION = "1.7.86";
private static final String DEFAULT_VERSION = "1.7.87";
private static final String REPO_NAME = "ripmeapp/ripme";
private static final String updateJsonURL = "https://raw.githubusercontent.com/" + REPO_NAME + "/master/ripme.json";
private static String mainFileName;
@ -264,12 +264,14 @@ public class UpdateUtils {
// Windows
final String batchFile = "update_ripme.bat";
final String batchPath = new File(batchFile).getAbsolutePath();
String script = "@echo off\r\n" + "timeout 1\r\n" + "copy " + updateFileName + " " + mainFileName + "\r\n"
+ "del " + updateFileName + "\r\n";
if (shouldLaunch) {
script += mainFileName + "\r\n";
}
script += "del " + batchPath + "\r\n";
String script = "@echo off\r\n" + "timeout 1\r\n"
+ "copy \"" + updateFileName + "\" \"" + mainFileName + "\"\r\n"
+ "del \"" + updateFileName + "\"\r\n";
if (shouldLaunch)
script += "\"" + mainFileName + "\"\r\n";
script += "del \"" + batchPath + "\"\r\n";
final String[] batchExec = new String[] { batchPath };
// Create updater script
try (BufferedWriter bw = new BufferedWriter(new FileWriter(batchFile))) {