Better rootPath

This commit is contained in:
fgnm
2020-08-06 10:43:48 +02:00
parent c82149fc0b
commit 877966fbb8
10 changed files with 6 additions and 32 deletions
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
{"pluginStorage":{"class":"java.util.HashMap","games.rednblack.editor.plugin.skincomposer":{"class":"java.util.HashMap","latest_update":{"class":"java.lang.String","value":"37"}}}}
@@ -50,11 +50,10 @@ public class BootstrapPlugins extends SimpleCommand {
PluginManager pluginManager = new PluginManager();
facade.registerProxy(pluginManager);
ProjectManager projectManager = facade.retrieveProxy(ProjectManager.NAME);
File[] pluginDirs = new File[] {new File(Main.getJarContainingFolder(Main.class) + File.separator + "plugins"),
new File(projectManager.getRootPath() + File.separator + "plugins")};
new File(settingsManager.getRootPath() + File.separator + "plugins")};
File cacheDir = new File(Main.getJarContainingFolder(Main.class) + File.separator + "cache");
File cacheDir = new File(settingsManager.getRootPath() + File.separator + "cache");
ModuleManager manager = new DefaultModuleManager();
for (File pluginDir : pluginDirs) {
@@ -1043,34 +1043,6 @@ public class ProjectManager extends BaseProxy {
return settings;
}
public String getRootPath() {
File root = new File(new File(".").getAbsolutePath()).getParentFile();
return root.getAbsolutePath();
}
private EditorConfigVO getEditorConfig() {
EditorConfigVO editorConfig = new EditorConfigVO();
String configFilePath = getRootPath() + File.separator + "configs" + File.separator + EditorConfigVO.EDITOR_CONFIG_FILE;
File configFile = new File(configFilePath);
if (!configFile.exists()) {
try {
FileUtils.writeStringToFile(new File(configFilePath), editorConfig.constructJsonString(), "utf-8");
} catch (IOException e) {
e.printStackTrace();
}
} else {
Json gson = new Json();
String editorConfigJson = null;
try {
editorConfigJson = FileUtils.readFileToString(Gdx.files.absolute(configFilePath).file());
editorConfig = gson.fromJson(EditorConfigVO.class, editorConfigJson);
} catch (IOException e) {
e.printStackTrace();
}
}
return editorConfig;
}
public void createNewProject(String projectPath, int originWidth, int originHeight, int pixelPerWorldUnit) {
if (projectPath == null || projectPath.equals("")) {
return;
@@ -319,8 +319,10 @@ public class ResourceManager extends BaseProxy implements IResourceRetriever {
/**
* @param fontPath
* TODO currently useless, but could be reworked to include stuff from Skin Composer
* @deprecated
*/
@Deprecated
private void loadCurrentProjectSkin(String fontPath) {
/*
File styleFile = new File(fontPath, "styles.dt");
@@ -82,7 +82,7 @@ public class SettingsManager extends BaseProxy {
public String getRootPath() {
File root = new File(new File(".").getAbsolutePath()).getParentFile();
return root.getAbsolutePath();
return root.getAbsolutePath() + File.separator + ".hyperlap2d";
}
public void setLastOpenedPath(String path) {