Skip to content

Commit

Permalink
LDEV-4862 - change properties location
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Jan 6, 2025
1 parent 0213cfb commit 31df91c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
4 changes: 2 additions & 2 deletions build.number
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
#Fri Dec 06 22:05:03 CET 2024
build.number=17
#Mon Jan 06 17:20:50 CET 2025
build.number=18
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

import lucee.commons.io.res.Resource;
import lucee.loader.engine.CFMLEngineFactory;
import lucee.runtime.config.Config;
import lucee.runtime.config.ConfigServer;
import lucee.runtime.config.ConfigWeb;
import lucee.runtime.util.IO;

public class PropertyDeployer {
Expand Down Expand Up @@ -55,26 +58,26 @@ static void createFileFromResource(String resource, Resource file) {
}
}

public static void deployIfNecessary() {
public static void deployIfNecessaryX() {
if (deployed) return;

Resource dir; // TODO better way to get a dir
try {
dir = CFMLEngineFactory.getInstance().getSystemUtil().getTempDirectory();
Config config = CFMLEngineFactory.getInstance().getThreadConfig();
Resource dir = null;
if (config instanceof ConfigWeb) {
dir = ((ConfigWeb) config).getConfigServerDir().getRealResource("esapi");
}
catch (IOException e) {
dir = CFMLEngineFactory.getInstance().getSystemUtil().getSystemDirectory();
else if (config instanceof ConfigServer) {
dir = config.getConfigDir().getRealResource("esapi");
}
else {
try {
dir = CFMLEngineFactory.getInstance().getSystemUtil().getTempDirectory().getRealResource("esapi224");
}
catch (IOException e) {
dir = CFMLEngineFactory.getInstance().getSystemUtil().getSystemDirectory().getRealResource("esapi224");
}
}

// delete the old property files
dir = dir.getRealResource("properties");
Resource f = dir.getRealResource("ESAPI.properties");
if (f.isFile()) f.delete();
f = dir.getRealResource("validation.properties");
if (f.isFile()) f.delete();

// create the new property files
dir = dir.getRealResource("esapi224");
String file = dir.getReal("ESAPI.properties");
create("/org/lucee/extension/esapi/resource/", "ESAPI.properties", dir);
create("/org/lucee/extension/esapi/resource/", "validation.properties", dir);
Expand Down

0 comments on commit 31df91c

Please sign in to comment.