-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Load scriptFile from filesystem first #13
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -163,7 +163,15 @@ private void makeExecutable(File file) | |
|
||
if (scriptFile == null) { | ||
out.write(("#!/bin/sh\n\nexec java " + flags + " -jar \"$0\" \"$@\"\n\n").getBytes("ASCII")); | ||
} else { | ||
} | ||
else if (Files.exists(Paths.get(scriptFile))) { | ||
getLog().debug(String.format("Loading file[%s] from filesystem", scriptFile)); | ||
|
||
byte[] script = Files.readAllBytes(Paths.get(scriptFile)); | ||
out.write(script); | ||
out.write(new byte[]{'\n', '\n'}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe also use this below (and make the byte array a constant) ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thought about that, went for the minimal change at first pass as I do not grok why the force into String and then back to bytes in the below code. Leaving intact to minimize scope of this bugfix, will then g o clean up. |
||
} | ||
else { | ||
getLog().debug(String.format("Loading file[%s] from jar[%s]", scriptFile, original)); | ||
|
||
try (final URLClassLoader loader = new URLClassLoader(new URL[]{original.toUri().toURL()}, null); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is different from the code below for the file in the classpath, is that intentional ? Specifically, the code below requires the file to be ASCII.