mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Don't copy files if identical versions.
This commit is contained in:
parent
98862fc57f
commit
6153d983f7
1 changed files with 19 additions and 15 deletions
|
@ -28,7 +28,7 @@ public class Main {
|
||||||
private static final String DISTRIBUTIONS_DIR =
|
private static final String DISTRIBUTIONS_DIR =
|
||||||
System.getProperty("user.home") + "/.kobalt/wrapper/dist";
|
System.getProperty("user.home") + "/.kobalt/wrapper/dist";
|
||||||
|
|
||||||
private final Properties properties = new Properties();
|
private final Properties wrapperProperties = new Properties();
|
||||||
|
|
||||||
private static int logLevel = 1;
|
private static int logLevel = 1;
|
||||||
|
|
||||||
|
@ -70,11 +70,11 @@ public class Main {
|
||||||
if (! config.exists()) {
|
if (! config.exists()) {
|
||||||
saveFile(config, PROPERTY_VERSION + "=" + version);
|
saveFile(config, PROPERTY_VERSION + "=" + version);
|
||||||
}
|
}
|
||||||
properties.load(new FileReader(config));
|
wrapperProperties.load(new FileReader(config));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getWrapperVersion() {
|
private String getWrapperVersion() {
|
||||||
return properties.getProperty(PROPERTY_VERSION);
|
return wrapperProperties.getProperty(PROPERTY_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isWindows() {
|
private boolean isWindows() {
|
||||||
|
@ -129,21 +129,25 @@ 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 (! version.equals(getWrapperVersion())) {
|
||||||
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());
|
|
||||||
}
|
}
|
||||||
|
new File(KOBALTW).setExecutable(true);
|
||||||
|
} else {
|
||||||
|
log(2, "Wrapper and current versions are identical");
|
||||||
}
|
}
|
||||||
new File(KOBALTW).setExecutable(true);
|
|
||||||
return kobaltJarFile;
|
return kobaltJarFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue