mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 00:17:11 -07:00
Generate kobaltw if possible.
This commit is contained in:
parent
7582a595ad
commit
0b5b437114
1 changed files with 25 additions and 8 deletions
|
@ -164,8 +164,24 @@ public class Main {
|
|||
if (! noOverwrite && ! 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);
|
||||
boolean extractFile = true;
|
||||
if (file.equals("kobaltw")) {
|
||||
File envFile = new File("/bin/env");
|
||||
if (!envFile.exists()) {
|
||||
envFile = new File("/usr/bin/env");
|
||||
}
|
||||
if (envFile.exists()) {
|
||||
log(2, "Located " + envFile.getAbsolutePath() + ", generating " + file);
|
||||
String content = "#!" + envFile.getAbsolutePath() + " bash\n"
|
||||
+ "java -jar $(dirname $0)/kobalt/wrapper/kobalt-wrapper.jar $*\n";
|
||||
Files.write(to, content.getBytes());
|
||||
extractFile = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (extractFile) {
|
||||
Path from = Paths.get(zipOutputDir, file);
|
||||
try {
|
||||
if (isWindows() && to.toFile().exists()) {
|
||||
log(1, "Windows detected, not overwriting " + to);
|
||||
|
@ -176,6 +192,7 @@ public class Main {
|
|||
log(1, "Couldn't copy " + from + " to " + to + ": " + ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!new File(KOBALTW).setExecutable(true)) {
|
||||
if (!isWindows()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue