Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Grasscutter
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
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
Keyboard shortcuts
?
Snippets
Groups
Projects
ziqian zhang
Grasscutter
Commits
74cbad26
Commit
74cbad26
authored
3 years ago
by
KingRainbow44
Browse files
Options
Downloads
Patches
Plain Diff
Fix `filenames` issue
parent
aa439430
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/emu/grasscutter/data/DataLoader.java
+13
-11
13 additions, 11 deletions
src/main/java/emu/grasscutter/data/DataLoader.java
with
13 additions
and
11 deletions
src/main/java/emu/grasscutter/data/DataLoader.java
+
13
−
11
View file @
74cbad26
...
@@ -6,11 +6,11 @@ import emu.grasscutter.tools.Tools;
...
@@ -6,11 +6,11 @@ import emu.grasscutter.tools.Tools;
import
emu.grasscutter.utils.FileUtils
;
import
emu.grasscutter.utils.FileUtils
;
import
emu.grasscutter.utils.Utils
;
import
emu.grasscutter.utils.Utils
;
import
java.io.*
;
import
java.io.FileInputStream
;
import
java.nio.file.FileSystems
;
import
java.io.FileNotFoundException
;
import
java.io.InputStream
;
import
java.nio.file.Path
;
import
java.nio.file.Path
;
import
java.util.List
;
import
java.util.List
;
import
java.util.regex.Pattern
;
import
static
emu
.
grasscutter
.
Configuration
.
DATA
;
import
static
emu
.
grasscutter
.
Configuration
.
DATA
;
...
@@ -18,10 +18,11 @@ public class DataLoader {
...
@@ -18,10 +18,11 @@ public class DataLoader {
/**
/**
* Load a data file by its name. If the file isn't found within the /data directory then it will fallback to the default within the jar resources
* Load a data file by its name. If the file isn't found within the /data directory then it will fallback to the default within the jar resources
*
@see #load(String, boolean)
*
* @param resourcePath The path to the data file to be loaded.
* @param resourcePath The path to the data file to be loaded.
* @return InputStream of the data file.
* @return InputStream of the data file.
* @throws FileNotFoundException
* @throws FileNotFoundException
* @see #load(String, boolean)
*/
*/
public
static
InputStream
load
(
String
resourcePath
)
throws
FileNotFoundException
{
public
static
InputStream
load
(
String
resourcePath
)
throws
FileNotFoundException
{
return
load
(
resourcePath
,
true
);
return
load
(
resourcePath
,
true
);
...
@@ -29,6 +30,7 @@ public class DataLoader {
...
@@ -29,6 +30,7 @@ public class DataLoader {
/**
/**
* Load a data file by its name.
* Load a data file by its name.
*
* @param resourcePath The path to the data file to be loaded.
* @param resourcePath The path to the data file to be loaded.
* @param useFallback If the file does not exist in the /data directory, should it use the default file in the jar?
* @param useFallback If the file does not exist in the /data directory, should it use the default file in the jar?
* @return InputStream of the data file.
* @return InputStream of the data file.
...
@@ -52,7 +54,7 @@ public class DataLoader {
...
@@ -52,7 +54,7 @@ public class DataLoader {
List
<
Path
>
filenames
=
FileUtils
.
getPathsFromResource
(
"/defaults/data/"
);
List
<
Path
>
filenames
=
FileUtils
.
getPathsFromResource
(
"/defaults/data/"
);
if
(
filenames
==
null
)
{
if
(
filenames
==
null
)
{
Grasscutter
.
getLogger
().
error
(
"We were unable to locate your default data files."
);
Grasscutter
.
getLogger
().
error
(
"We were unable to locate your default data files."
);
return
;
}
}
for
(
Path
file
:
filenames
)
{
for
(
Path
file
:
filenames
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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