mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Generate wrapperVersion.txt in .kobalt.
This commit is contained in:
parent
83dfe4f5e4
commit
7b068bb111
1 changed files with 15 additions and 15 deletions
|
@ -29,6 +29,7 @@ public class Main {
|
||||||
private static final String FILE_NAME = "kobalt";
|
private static final String FILE_NAME = "kobalt";
|
||||||
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 static final File VERSION_TXT = new File(".kobalt", "wrapperVersion.txt");
|
||||||
|
|
||||||
private final Properties wrapperProperties = new Properties();
|
private final Properties wrapperProperties = new Properties();
|
||||||
|
|
||||||
|
@ -143,9 +144,7 @@ public class Main {
|
||||||
return System.getProperty("os.name").contains("Windows");
|
return System.getProperty("os.name").contains("Windows");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String OUT_DIR = "kobalt/wrapper/";
|
private static final String[] FILES = new String[] { KOBALTW, "kobalt/wrapper/" + FILE_NAME + "-wrapper.jar" };
|
||||||
private static final String[] FILES = new String[] { KOBALTW, OUT_DIR + FILE_NAME + "-wrapper.jar" };
|
|
||||||
private static final String VERSION_TXT = "wrapper-version.txt";
|
|
||||||
|
|
||||||
private Path installDistribution() throws IOException {
|
private Path installDistribution() throws IOException {
|
||||||
String wrapperVersion;
|
String wrapperVersion;
|
||||||
|
@ -201,7 +200,8 @@ public class Main {
|
||||||
// If the user didn't specify --noOverwrite, compare the installed wrapper to the one
|
// If the user didn't specify --noOverwrite, compare the installed wrapper to the one
|
||||||
// we're trying to install and if they are the same, no need to overwrite
|
// we're trying to install and if they are the same, no need to overwrite
|
||||||
if (! noOverwrite) {
|
if (! noOverwrite) {
|
||||||
try (FileReader fw = new FileReader(new File(OUT_DIR, VERSION_TXT))) {
|
if (VERSION_TXT.exists()) {
|
||||||
|
try (FileReader fw = new FileReader(VERSION_TXT)) {
|
||||||
try (BufferedReader bw = new BufferedReader(fw)) {
|
try (BufferedReader bw = new BufferedReader(fw)) {
|
||||||
String installedVersion = bw.readLine();
|
String installedVersion = bw.readLine();
|
||||||
if (!wrapperVersion.equals(installedVersion)) {
|
if (!wrapperVersion.equals(installedVersion)) {
|
||||||
|
@ -213,7 +213,7 @@ public class Main {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -244,8 +244,8 @@ public class Main {
|
||||||
//
|
//
|
||||||
// Save wrapper-version.txt
|
// Save wrapper-version.txt
|
||||||
//
|
//
|
||||||
log(2, " Writing version.txt");
|
log(2, " Writing " + VERSION_TXT);
|
||||||
try (FileWriter fw = new FileWriter(new File(OUT_DIR, VERSION_TXT))) {
|
try (FileWriter fw = new FileWriter(VERSION_TXT)) {
|
||||||
try (BufferedWriter bw = new BufferedWriter(fw)) {
|
try (BufferedWriter bw = new BufferedWriter(fw)) {
|
||||||
bw.write(wrapperVersion);
|
bw.write(wrapperVersion);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue