1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 08:27:12 -07:00

Only overwrite kobaltw for new versions.

This commit is contained in:
Cedric Beust 2015-11-15 16:47:31 -08:00
parent 087cb81e08
commit 81eaf51367

View file

@ -112,7 +112,8 @@ public class Main {
private Path installJarFile() throws IOException { private Path installJarFile() throws IOException {
Properties properties = maybeCreateProperties(); Properties properties = maybeCreateProperties();
initWrapperFile(properties.getProperty(PROPERTY_VERSION)); String version = properties.getProperty(PROPERTY_VERSION);
initWrapperFile(version);
String wrapperVersion = getWrapperVersion(); String wrapperVersion = getWrapperVersion();
log(2, "Wrapper version: " + wrapperVersion); log(2, "Wrapper version: " + wrapperVersion);
@ -147,24 +148,26 @@ public class Main {
// //
// Copy the wrapper files in the current kobalt/wrapper directory // Copy the wrapper files in the current kobalt/wrapper directory
// //
log(2, "Copying the wrapper files"); if (! wrapperVersion.equals(version)) {
for (String file : FILES) { log(2, "Copying the wrapper files");
Path from = Paths.get(zipOutputDir, file); for (String file : FILES) {
Path to = Paths.get(new File(".").getAbsolutePath(), file); Path from = Paths.get(zipOutputDir, file);
try { Path to = Paths.get(new File(".").getAbsolutePath(), file);
if (isWindows() && to.toFile().exists()) { try {
log(1, "Windows detected, not overwriting " + to); if (isWindows() && to.toFile().exists()) {
} else { log(1, "Windows detected, not overwriting " + to);
Files.copy(from, to, StandardCopyOption.REPLACE_EXISTING); } else {
Files.copy(from, to, StandardCopyOption.REPLACE_EXISTING);
}
} catch (IOException ex) {
log(1, "Couldn't copy " + from + " to " + to + ": " + ex.getMessage());
} }
} catch (IOException ex) {
log(1, "Couldn't copy " + from + " to " + to + ": " + ex.getMessage());
} }
}
if (!new File(KOBALTW).setExecutable(true)) { if (!new File(KOBALTW).setExecutable(true)) {
if (!isWindows()) { if (!isWindows()) {
log(1, "Couldn't make " + KOBALTW + " executable"); log(1, "Couldn't make " + KOBALTW + " executable");
}
} }
} }