Skip to content

Commit

Permalink
Use Paths.get for templateDir/outputDir
Browse files Browse the repository at this point in the history
* Fix CodegenConfigurator library setting
  • Loading branch information
jimschubert committed May 20, 2019
1 parent 421986b commit a67b944
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.slf4j.LoggerFactory;

import java.io.File;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
Expand Down Expand Up @@ -292,7 +293,7 @@ public Builder withInputSpec(String inputSpec) {
* @return a reference to this Builder
*/
public Builder withOutputDir(String outputDir) {
this.outputDir = outputDir;
this.outputDir = Paths.get(outputDir).toAbsolutePath().toString();;
return this;
}

Expand Down Expand Up @@ -402,7 +403,7 @@ public Builder withTemplateDir(String templateDir) {
"Template directory " + templateDir + " does not exist.");
}

this.templateDir = f.getAbsolutePath();
this.templateDir = Paths.get(f.toURI()).toAbsolutePath().toString();
}

return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,13 +427,14 @@ public ClientOptInput toClientOptInput() {

CodegenConfig config = CodegenConfigLoader.forName(generatorName);

if (isNotEmpty(config.getLibrary())) {
config.setLibrary(config.getLibrary());
}

WorkflowSettings workflowSettings = context.getWorkflowSettings();
GeneratorSettings generatorSettings = context.getGeneratorSettings();

if (isNotEmpty(generatorSettings.getLibrary())) {
config.setLibrary(generatorSettings.getLibrary());
}

// TODO: Work toward CodegenConfig having a "WorkflowSettings" property, or better a "Workflow" object which itself has a "WorkflowSettings" property.
config.setInputSpec(workflowSettings.getInputSpec());
config.setOutputDir(workflowSettings.getOutputDir());
Expand Down

0 comments on commit a67b944

Please sign in to comment.