Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
BraillePlot
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Georg Graßnick
BraillePlot
Commits
6c973543
Commit
6c973543
authored
5 years ago
by
Leonard Kupper
Browse files
Options
Downloads
Patches
Plain Diff
Add m prefix
parent
2da4bb97
No related branches found
No related tags found
1 merge request
!28
Bug/jar resource handling 49
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/de/tudresden/inf/mci/brailleplot/GeneralResource.java
+9
-9
9 additions, 9 deletions
...ava/de/tudresden/inf/mci/brailleplot/GeneralResource.java
with
9 additions
and
9 deletions
src/main/java/de/tudresden/inf/mci/brailleplot/GeneralResource.java
+
9
−
9
View file @
6c973543
...
@@ -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
v
alidExternalFile
=
false
;
private
boolean
mV
alidExternalFile
=
false
;
private
boolean
v
alidPackedResource
=
false
;
private
boolean
mV
alidPackedResource
=
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
();
v
alidExternalFile
=
true
;
mV
alidExternalFile
=
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
();
v
alidExternalFile
=
true
;
mV
alidExternalFile
=
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
();
v
alidExternalFile
=
true
;
mV
alidExternalFile
=
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
;
v
alidPackedResource
=
true
;
mV
alidPackedResource
=
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
;
v
alidPackedResource
=
true
;
mV
alidPackedResource
=
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
v
alidExternalFile
;
return
mV
alidExternalFile
;
}
}
public
boolean
isValidPackedResource
()
{
public
boolean
isValidPackedResource
()
{
return
v
alidPackedResource
;
return
mV
alidPackedResource
;
}
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment