From 765dd485e343310ac7646fd4eb3565ced7bed579 Mon Sep 17 00:00:00 2001 From: Sam Carlberg Date: Sat, 29 Oct 2016 06:50:16 -0400 Subject: [PATCH] Fix code generation with Windows native app (#694) Closes #684 --- .../java/edu/wpi/grip/ui/codegeneration/Exporter.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/src/main/java/edu/wpi/grip/ui/codegeneration/Exporter.java b/ui/src/main/java/edu/wpi/grip/ui/codegeneration/Exporter.java index cea7aeaf7b..f55ac9be55 100644 --- a/ui/src/main/java/edu/wpi/grip/ui/codegeneration/Exporter.java +++ b/ui/src/main/java/edu/wpi/grip/ui/codegeneration/Exporter.java @@ -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); @@ -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")) { @@ -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);