Skip to content
Snippets Groups Projects
Commit 6c973543 authored by Leonard Kupper's avatar Leonard Kupper
Browse files

Add m prefix

parent 2da4bb97
No related branches found
No related tags found
1 merge request!28Bug/jar resource handling 49
...@@ -25,8 +25,8 @@ import java.util.jar.JarFile; ...@@ -25,8 +25,8 @@ import java.util.jar.JarFile;
public final class GeneralResource { public final class GeneralResource {
private String mResourcePath; private String mResourcePath;
private boolean validExternalFile = false; private boolean mValidExternalFile = false;
private boolean validPackedResource = false; private boolean mValidPackedResource = false;
private static boolean mExportOverride = !isRunFromCompiledJar(); private static boolean mExportOverride = !isRunFromCompiledJar();
private static File tempDirectory = new File(System.getProperty("java.io.tmpdir") + File.separator + "brailleplot"); private static File tempDirectory = new File(System.getProperty("java.io.tmpdir") + File.separator + "brailleplot");
private static Logger mLogger = LoggerFactory.getLogger(getClassRef()); private static Logger mLogger = LoggerFactory.getLogger(getClassRef());
...@@ -52,14 +52,14 @@ public final class GeneralResource { ...@@ -52,14 +52,14 @@ public final class GeneralResource {
if (checkFile.isFile()) { if (checkFile.isFile()) {
mLogger.trace("Interpreting path as file: " + checkFile.getCanonicalPath()); mLogger.trace("Interpreting path as file: " + checkFile.getCanonicalPath());
mResourcePath = checkFile.getCanonicalPath(); mResourcePath = checkFile.getCanonicalPath();
validExternalFile = true; mValidExternalFile = true;
} }
checkFile = checkFile.getAbsoluteFile(); checkFile = checkFile.getAbsoluteFile();
mLogger.trace("Checking referenced path as absolute path: " + checkFile); mLogger.trace("Checking referenced path as absolute path: " + checkFile);
if (checkFile.isFile()) { if (checkFile.isFile()) {
mLogger.trace("Interpreting path as absolute file: " + checkFile.getCanonicalPath()); mLogger.trace("Interpreting path as absolute file: " + checkFile.getCanonicalPath());
mResourcePath = checkFile.getCanonicalPath(); mResourcePath = checkFile.getCanonicalPath();
validExternalFile = true; mValidExternalFile = true;
} }
if (Objects.nonNull(searchPath)) { if (Objects.nonNull(searchPath)) {
checkFile = new File(searchPath + File.separator + resourcePath); checkFile = new File(searchPath + File.separator + resourcePath);
...@@ -67,7 +67,7 @@ public final class GeneralResource { ...@@ -67,7 +67,7 @@ public final class GeneralResource {
if (checkFile.isFile()) { if (checkFile.isFile()) {
mLogger.trace("Interpreting path as search path relative file: " + checkFile.getCanonicalPath()); mLogger.trace("Interpreting path as search path relative file: " + checkFile.getCanonicalPath());
mResourcePath = checkFile.getCanonicalPath(); mResourcePath = checkFile.getCanonicalPath();
validExternalFile = true; mValidExternalFile = true;
} }
} }
String resourceClassPath = resourcePath.replace("\\", "/"); // classpaths are always separated by forward slash String resourceClassPath = resourcePath.replace("\\", "/"); // classpaths are always separated by forward slash
...@@ -76,7 +76,7 @@ public final class GeneralResource { ...@@ -76,7 +76,7 @@ public final class GeneralResource {
if (Objects.nonNull(checkStream)) { if (Objects.nonNull(checkStream)) {
mLogger.trace("Interpreting path as resource stream: " + resourceClassPath); mLogger.trace("Interpreting path as resource stream: " + resourceClassPath);
mResourcePath = resourceClassPath; mResourcePath = resourceClassPath;
validPackedResource = true; mValidPackedResource = true;
} }
if (Objects.nonNull(searchPath)) { if (Objects.nonNull(searchPath)) {
String relativeResourcePath = new File(searchPath + File.separator + resourceClassPath).toPath().normalize().toString(); String relativeResourcePath = new File(searchPath + File.separator + resourceClassPath).toPath().normalize().toString();
...@@ -86,7 +86,7 @@ public final class GeneralResource { ...@@ -86,7 +86,7 @@ public final class GeneralResource {
if (Objects.nonNull(checkStream)) { if (Objects.nonNull(checkStream)) {
mLogger.trace("Interpreting path as resource stream: " + relativeResourcePath); mLogger.trace("Interpreting path as resource stream: " + relativeResourcePath);
mResourcePath = relativeResourcePath; mResourcePath = relativeResourcePath;
validPackedResource = true; mValidPackedResource = true;
} }
} }
if (!(isValidExternalFile() || isValidPackedResource())) { if (!(isValidExternalFile() || isValidPackedResource())) {
...@@ -95,11 +95,11 @@ public final class GeneralResource { ...@@ -95,11 +95,11 @@ public final class GeneralResource {
} }
public boolean isValidExternalFile() { public boolean isValidExternalFile() {
return validExternalFile; return mValidExternalFile;
} }
public boolean isValidPackedResource() { public boolean isValidPackedResource() {
return validPackedResource; return mValidPackedResource;
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment