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