Skip to content

Commit

Permalink
Change dirs. Add LD_LIBRARY_PATH setup.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nashatyrev committed Mar 3, 2016
1 parent dd4158b commit 2326803
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ private Solc() {
}

private void init() throws IOException {
File tmpDir = new File(System.getProperty("java.io.tmpdir"));
File tmpDir = new File(System.getProperty("java.io.tmpdir"), "solc");

InputStream is = getClass().getResourceAsStream("/bin/" + getOS() + "/file.list");
InputStream is = getClass().getResourceAsStream("/native/" + getOS() + "/solc/file.list");
Scanner scanner = new Scanner(is);
while (scanner.hasNext()) {
String s = scanner.next();
File targetFile = new File(tmpDir, s);
if (!targetFile.canRead()) {
InputStream fis = getClass().getResourceAsStream("/bin/" + getOS() + "/" + s);
InputStream fis = getClass().getResourceAsStream("/native/" + getOS() + "/solc/" + s);
Files.copy(fis, targetFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
}
if (solc == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,12 @@ public static Result compile(byte[] source, boolean combinedJson, Options... opt
}
}

Process process = new ProcessBuilder(commandParts)
.directory(Solc.INSTANCE.getExecutable().getParentFile())
.start();
ProcessBuilder processBuilder = new ProcessBuilder(commandParts)
.directory(Solc.INSTANCE.getExecutable().getParentFile());
processBuilder.environment().put("LD_LIBRARY_PATH",
Solc.INSTANCE.getExecutable().getParentFile().getCanonicalPath());

Process process = processBuilder.start();

try (BufferedOutputStream stream = new BufferedOutputStream(process.getOutputStream())) {
stream.write(source);
Expand Down

0 comments on commit 2326803

Please sign in to comment.