Skip to content

Commit

Permalink
Fix code generation with Windows native app (#694)
Browse files Browse the repository at this point in the history
Closes #684
  • Loading branch information
SamCarlberg authored and AustinShalit committed Oct 29, 2016
1 parent 54d98ea commit 765dd48
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ui/src/main/java/edu/wpi/grip/ui/codegeneration/Exporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void run() {
context.put("vmLoc", templateDir);
VelocityEngine ve = new VelocityEngine();
Properties props = new Properties();
props.put("velocimacro.library", templateDir + File.separator + "macros.vm");
props.put("velocimacro.library", templateDir + "/macros.vm");
props.put(RuntimeConstants.RESOURCE_LOADER, "classpath");
props.put("classpath.resource.loader.class", ClasspathResourceLoader.class.getName());
ve.init(props);
Expand Down Expand Up @@ -136,7 +136,7 @@ private boolean isExportable(Step step) {
*/
private void generateCode(VelocityEngine ve, String templateDir, File file,
VelocityContext context) {
Template tm = ve.getTemplate(templateDir + File.separator + PIPELINE_TEMPLATE);
Template tm = ve.getTemplate(templateDir + "/" + PIPELINE_TEMPLATE);
StringWriter sw = new StringWriter();
tm.merge(context, sw);
try (PrintWriter writer = new PrintWriter(file.getAbsolutePath(), "UTF-8")) {
Expand All @@ -157,11 +157,11 @@ private void generateCode(VelocityEngine ve, String templateDir, File file,
*/
private void generateH(VelocityEngine ve, String templateDir, File file,
VelocityContext context) {
Template tm = ve.getTemplate(templateDir + File.separator + PIPELINE_HTEMPLATE);
Template tm = ve.getTemplate(templateDir + "/" + PIPELINE_HTEMPLATE);
StringWriter sw = new StringWriter();
tm.merge(context, sw);
try (PrintWriter writer = new PrintWriter(file.getParentFile().getAbsolutePath()
+ File.separator + file.getName().replace(".cpp", ".h"), "UTF-8")) {
+ "/" + file.getName().replace(".cpp", ".h"), "UTF-8")) {
writer.println(sw);
} catch (UnsupportedEncodingException | FileNotFoundException e) {
logger.log(Level.SEVERE, "Unable to write to file", e);
Expand Down

0 comments on commit 765dd48

Please sign in to comment.