Remove the extra slash while loading resources. (#893)

* Remove the extra slash

* Update src/main/java/emu/grasscutter/Configuration.java

Co-authored-by: HotaruYS <105128850+HotaruYS@users.noreply.github.com>

* Update src/main/java/emu/grasscutter/Configuration.java

Co-authored-by: HotaruYS <105128850+HotaruYS@users.noreply.github.com>

* Update src/main/java/emu/grasscutter/Configuration.java

Co-authored-by: HotaruYS <105128850+HotaruYS@users.noreply.github.com>

* Import java.nio.file.Paths to use Paths.get

* Mark fields as private to prevent use *FOLDER directly

* Remove unnecessary slash

Co-authored-by: HotaruYS <105128850+HotaruYS@users.noreply.github.com>
This commit is contained in:
line-bear
2022-05-16 14:32:03 +08:00
committed by GitHub
parent eb64b25f12
commit 87966b9e98
7 changed files with 43 additions and 22 deletions

View File

@@ -37,7 +37,7 @@ public abstract class Plugin {
this.identifier = identifier;
this.classLoader = classLoader;
this.dataFolder = new File(PLUGINS_FOLDER, identifier.name);
this.dataFolder = new File(PLUGIN(), identifier.name);
this.logger = LoggerFactory.getLogger(identifier.name);
if(!this.dataFolder.exists() && !this.dataFolder.mkdirs()) {

View File

@@ -34,7 +34,7 @@ public final class PluginManager {
* Loads plugins from the config-specified directory.
*/
private void loadPlugins() {
File pluginsDir = new File(Utils.toFilePath(PLUGINS_FOLDER));
File pluginsDir = new File(Utils.toFilePath(PLUGIN()));
if(!pluginsDir.exists() && !pluginsDir.mkdirs()) {
Grasscutter.getLogger().error("Failed to create plugins directory: " + pluginsDir.getAbsolutePath());
return;