Skip to content

Commit

Permalink
Merge pull request #154 from blackducksoftware/sb_changeDiWorkingDir
Browse files Browse the repository at this point in the history
Sb change di working dir
  • Loading branch information
stevebillings committed Apr 22, 2020
2 parents 81ebee2 + aa8c0a8 commit ed9810e
Showing 1 changed file with 9 additions and 0 deletions.
Expand Up @@ -25,6 +25,7 @@
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.util.Map;
import java.util.Properties;

Expand All @@ -47,6 +48,8 @@ public void populatePropertiesFile(final File dockerPropertiesFile, final File o
dockerProperties.setProperty("output.path", outputDirectory.getAbsolutePath());
dockerProperties.setProperty("phone.home", "false");
dockerProperties.setProperty("caller.name", "Detect");
dockerProperties.setProperty("working.dir.path", createDir(outputDirectory, "inspectorWorkingDir").getAbsolutePath());
dockerProperties.setProperty("shared.dir.path.local", createDir(outputDirectory, "inspectorSharedDir").getAbsolutePath());

// Request both of the following; DI pre-8.1.0 will only recognize/return containerfilesystem.
// DI 8.1.0 and newer will provide both; Detect will prefer squashedimage
Expand All @@ -62,4 +65,10 @@ public void populatePropertiesFile(final File dockerPropertiesFile, final File o
logger.debug("Contents of application.properties passed to Docker Inspector: " + dockerProperties.toString());
dockerProperties.store(new FileOutputStream(dockerPropertiesFile), "");
}

private File createDir(final File parentDir, final String newDirName) throws IOException {
final File newDir = new File(parentDir, newDirName);
Files.createDirectories(newDir.toPath());
return newDir;
}
}

0 comments on commit ed9810e

Please sign in to comment.