1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-08-24 06:23:52 +02: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 { public class UpdateUtils {
private static final Logger logger = Logger.getLogger(UpdateUtils.class); 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 REPO_NAME = "ripmeapp/ripme";
private static final String updateJsonURL = "https://raw.githubusercontent.com/" + REPO_NAME + "/master/ripme.json"; private static final String updateJsonURL = "https://raw.githubusercontent.com/" + REPO_NAME + "/master/ripme.json";
private static String mainFileName; private static String mainFileName;
@@ -264,12 +264,14 @@ public class UpdateUtils {
// Windows // Windows
final String batchFile = "update_ripme.bat"; final String batchFile = "update_ripme.bat";
final String batchPath = new File(batchFile).getAbsolutePath(); final String batchPath = new File(batchFile).getAbsolutePath();
String script = "@echo off\r\n" + "timeout 1\r\n" + "copy " + updateFileName + " " + mainFileName + "\r\n" String script = "@echo off\r\n" + "timeout 1\r\n"
+ "del " + updateFileName + "\r\n"; + "copy \"" + updateFileName + "\" \"" + mainFileName + "\"\r\n"
if (shouldLaunch) { + "del \"" + updateFileName + "\"\r\n";
script += mainFileName + "\r\n";
} if (shouldLaunch)
script += "del " + batchPath + "\r\n"; script += "\"" + mainFileName + "\"\r\n";
script += "del \"" + batchPath + "\"\r\n";
final String[] batchExec = new String[] { batchPath }; final String[] batchExec = new String[] { batchPath };
// Create updater script // Create updater script
try (BufferedWriter bw = new BufferedWriter(new FileWriter(batchFile))) { try (BufferedWriter bw = new BufferedWriter(new FileWriter(batchFile))) {