Skip to content

Commit

Permalink
Secondary files relative path patch
Browse files Browse the repository at this point in the history
  • Loading branch information
Milos Ljubinkovic committed Jan 10, 2018
1 parent 75c00e2 commit 678ceec
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions rabix-cli/src/main/java/org/rabix/cli/BackendCommandLine.java
Expand Up @@ -364,14 +364,11 @@ protected void configure() {
if (inputsFile != null) {
final Path finalInputs = inputsFile;
FileValueHelper.updateFileValues(commonInputs, (FileValue f) -> {
String path = f.getPath();
if (path != null && !Paths.get(path).isAbsolute()) {
f.setPath(finalInputs.resolveSibling(path).normalize().toString());
}
String location = f.getLocation();
if (location != null && URI.create(location).getScheme() == null) {
f.setLocation(finalInputs.resolveSibling(location).normalize().toString());
}
fixPaths(finalInputs, f);
if (f.getSecondaryFiles() != null)
for (FileValue sec : f.getSecondaryFiles()) {
fixPaths(finalInputs, sec);
}
return f;
});
}
Expand All @@ -394,6 +391,18 @@ protected void configure() {
}


private static void fixPaths(final Path finalInputs, FileValue f) {
String path = f.getPath();
if (path != null && !Paths.get(path).isAbsolute()) {
f.setPath(finalInputs.resolveSibling(path).normalize().toString());
}
String location = f.getLocation();
if (location != null && URI.create(location).getScheme() == null) {
f.setLocation(finalInputs.resolveSibling(location).normalize().toString());
}
}


/**
* Prints resolved application on standard out
*/
Expand Down

0 comments on commit 678ceec

Please sign in to comment.