Skip to content

Commit

Permalink
create specified tmp directory if it does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
kermitt2 committed Jan 1, 2021
1 parent e7c08d0 commit c4b2aae
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public GrobidProperties() {

//getProps().putAll(getEnvironmentVariableOverrides(System.getenv()));

//initializePaths();
initializeTmpPath();
// TBD: tmp to be created
loadPdfaltoPath();
createModelMap();
Expand All @@ -243,14 +243,26 @@ public GrobidProperties() {
/**
* Create a map between model names and associated parameters
*/
private void createModelMap() {
private static void createModelMap() {
for(ModelParameters modelParameter : grobidConfig.grobid.models) {
if (modelMap == null)
modelMap = new TreeMap<>();
modelMap.put(modelParameter.name, modelParameter);
}
}

/**
* Create indicated tmp path if it does not exist
*/
private void initializeTmpPath() {
File tmpDir = getTempPath();
if (!tmpDir.exists()) {
if (!tmpDir.mkdirs()) {
LOGGER.warn("tmp does not exist and unable to create tmp directory: " + tmpDir.getAbsolutePath());
}
}
}

/**
* Return the distinct values of all the engines that are specified in the the config file
*/
Expand Down

0 comments on commit c4b2aae

Please sign in to comment.