Skip to content

Commit 7b64c05

Browse files
committed
Fix incorrect path when generating standalone environment. (CMDHELPER-3087)
1 parent 2917f1b commit 7b64c05

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/main/java/com/laytonsmith/core/Static.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,18 +1275,12 @@ public static void AssertNonNull(Object var, String message) throws NullPointerE
12751275
* @throws URISyntaxException
12761276
*/
12771277
public static Environment GenerateStandaloneEnvironment() throws IOException, DataSourceException, URISyntaxException, Profiles.InvalidProfileException {
1278-
File jarLocation;
1279-
if (Static.class.getProtectionDomain().getCodeSource().getLocation() != null) {
1280-
jarLocation = new File(Static.class.getProtectionDomain().getCodeSource().getLocation().getFile()).getParentFile();
1281-
} else {
1282-
jarLocation = new File(".");
1283-
}
1284-
File platformFolder = new File(jarLocation, Implementation.GetServerType().getBranding() + "/");
1278+
File platformFolder = MethodScriptFileLocations.getDefault().getConfigDirectory();
12851279
Installer.Install(platformFolder);
12861280
ConnectionMixinFactory.ConnectionMixinOptions options = new ConnectionMixinFactory.ConnectionMixinOptions();
12871281
options.setWorkingDirectory(platformFolder);
12881282
PersistenceNetwork persistenceNetwork = new PersistenceNetwork(MethodScriptFileLocations.getDefault().getPersistenceConfig(),
1289-
new URI("sqlite://" + new File(platformFolder, "persistence.db").getCanonicalPath().replace("\\", "/")), options);
1283+
new URI("sqlite://" + new File(platformFolder, "persistence.db").getCanonicalPath().replace('\\', '/')), options);
12901284
GlobalEnv gEnv = new GlobalEnv(new MethodScriptExecutionQueue("MethodScriptExecutionQueue", "default"),
12911285
new Profiler(MethodScriptFileLocations.getDefault().getProfilerConfigFile()), persistenceNetwork, platformFolder,
12921286
new Profiles(MethodScriptFileLocations.getDefault().getProfilesFile()), new TaskManager());

0 commit comments

Comments
 (0)