From ff709ba31496c1832f8825e3ce4fe8ee2ccd915c Mon Sep 17 00:00:00 2001 From: ME1312 Date: Wed, 16 Jun 2021 00:38:00 -0400 Subject: [PATCH] Allow build scripts to reference a template's source files --- .../Bungee/Host/Internal/InternalSubCreator.java | 10 +++------- .../SubServers/Host/Executable/SubCreatorImpl.java | 10 +++------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Host/Internal/InternalSubCreator.java b/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Host/Internal/InternalSubCreator.java index 11797929..328b45bc 100644 --- a/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Host/Internal/InternalSubCreator.java +++ b/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Host/Internal/InternalSubCreator.java @@ -178,17 +178,13 @@ public class InternalSubCreator extends SubCreator { } if (template.getBuildOptions().contains("Executable")) { - File cache; + File cache = null; if (template.getBuildOptions().getBoolean("Use-Cache", true)) { cache = new UniversalFile(host.plugin.dir, "SubServers:Cache:Templates:" + template.getName()); cache.mkdirs(); - String c = cache.toString(); - if (System.getProperty("os.name").toLowerCase().startsWith("windows") && - (template.getBuildOptions().getRawString("Executable").toLowerCase().startsWith("bash ") || template.getBuildOptions().getRawString("Executable").toLowerCase().startsWith("sh "))) c = c.replace(File.separatorChar, '/'); - var.put("cache", c); - } else { - cache = null; + var.put("cache", cache.getAbsolutePath()); } + var.put("source", dir.getAbsolutePath()); try { Logger.get(prefix).info("Launching Build Script..."); diff --git a/SubServers.Host/src/net/ME1312/SubServers/Host/Executable/SubCreatorImpl.java b/SubServers.Host/src/net/ME1312/SubServers/Host/Executable/SubCreatorImpl.java index 37d8adf2..3a3aad7d 100644 --- a/SubServers.Host/src/net/ME1312/SubServers/Host/Executable/SubCreatorImpl.java +++ b/SubServers.Host/src/net/ME1312/SubServers/Host/Executable/SubCreatorImpl.java @@ -378,17 +378,13 @@ public class SubCreatorImpl { } if (template.getBuildOptions().contains("Executable")) { - File cache; + File cache = null; if (template.getBuildOptions().getBoolean("Use-Cache", true)) { cache = new UniversalFile(GalaxiEngine.getInstance().getRuntimeDirectory(), "Cache:Templates:" + template.getName()); cache.mkdirs(); - String c = cache.toString(); - if (System.getProperty("os.name").toLowerCase().startsWith("windows") && - (template.getBuildOptions().getRawString("Executable").toLowerCase().startsWith("bash ") || template.getBuildOptions().getRawString("Executable").toLowerCase().startsWith("sh "))) c = c.replace(File.separatorChar, '/'); - var.put("cache", c); - } else { - cache = null; + var.put("cache", cache.getAbsolutePath()); } + var.put("source", dir.getAbsolutePath()); try { log.logger.info.println("Launching Build Script...");