mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 00:17:11 -07:00
Skip version check before extracting.
This commit is contained in:
parent
05a4fe0230
commit
3b0e1d4a55
1 changed files with 15 additions and 4 deletions
|
@ -52,7 +52,7 @@ public class Main {
|
||||||
kobaltArgv.add(argv[i]);
|
kobaltArgv.add(argv[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Path kobaltJarFile = installJarFile();
|
Path kobaltJarFile = installDistribution();
|
||||||
if (! noLaunch) {
|
if (! noLaunch) {
|
||||||
launchMain(kobaltJarFile, kobaltArgv.toArray(new String[kobaltArgv.size()]));
|
launchMain(kobaltJarFile, kobaltArgv.toArray(new String[kobaltArgv.size()]));
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ public class Main {
|
||||||
return System.getProperty("os.name").contains("Windows");
|
return System.getProperty("os.name").contains("Windows");
|
||||||
}
|
}
|
||||||
|
|
||||||
private Path installJarFile() throws IOException {
|
private Path installDistribution() throws IOException {
|
||||||
Properties properties = maybeCreateProperties();
|
Properties properties = maybeCreateProperties();
|
||||||
|
|
||||||
String version = properties.getProperty(PROPERTY_VERSION);
|
String version = properties.getProperty(PROPERTY_VERSION);
|
||||||
|
@ -161,12 +161,20 @@ public class Main {
|
||||||
//
|
//
|
||||||
// Copy the wrapper files in the current kobalt/wrapper directory
|
// Copy the wrapper files in the current kobalt/wrapper directory
|
||||||
//
|
//
|
||||||
if (! noOverwrite && ! wrapperVersion.equals(version)) {
|
if (! noOverwrite) {
|
||||||
log(2, "Copying the wrapper files");
|
log(2, "Copying the wrapper files");
|
||||||
for (String file : FILES) {
|
for (String file : FILES) {
|
||||||
Path to = Paths.get(new File(".").getAbsolutePath(), file);
|
Path to = Paths.get(new File(".").getAbsolutePath(), file);
|
||||||
|
if (Files.exists(to)) {
|
||||||
|
log(1, to + " already exists, not overwriting it");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
boolean extractFile = true;
|
boolean extractFile = true;
|
||||||
if (file.equals("kobaltw")) {
|
if (file.equals(KOBALTW)) {
|
||||||
|
//
|
||||||
|
// For kobaltw: try to generate it with the correct env shebang. If this fails,
|
||||||
|
// we'll extract the one from the zip file
|
||||||
|
//
|
||||||
File envFile = new File("/bin/env");
|
File envFile = new File("/bin/env");
|
||||||
if (!envFile.exists()) {
|
if (!envFile.exists()) {
|
||||||
envFile = new File("/usr/bin/env");
|
envFile = new File("/usr/bin/env");
|
||||||
|
@ -204,6 +212,9 @@ public class Main {
|
||||||
return kobaltJarFile;
|
return kobaltJarFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extract the zip file in ~/.kobalt/wrapper/dist/$version
|
||||||
|
*/
|
||||||
private void extractZipFile(Path localZipFile, String zipOutputDir) throws IOException {
|
private void extractZipFile(Path localZipFile, String zipOutputDir) throws IOException {
|
||||||
log(2, "Extracting " + localZipFile);
|
log(2, "Extracting " + localZipFile);
|
||||||
try (ZipFile zipFile = new ZipFile(localZipFile.toFile())) {
|
try (ZipFile zipFile = new ZipFile(localZipFile.toFile())) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue