Pārlūkot izejas kodu

Issue #51 all data is now saved under /.config/HolonGUI

jess 7 gadi atpakaļ
vecāks
revīzija
c58a7957f2

+ 2 - 2
src/ui/controller/Control.java

@@ -81,8 +81,8 @@ public class Control {
 				objectController, nodeController, multiPurposeController);
 		this.holonCanvasController = new HolonCanvasController(model);
 
-		autosaveDir = System.getProperty("user.home") + "/HolonGUI/Autosave/";
-		categoryDir = System.getProperty("user.home") + "/HolonGUI/Category/";
+		autosaveDir = System.getProperty("user.home") + "/.config/HolonGUI/Autosave/";
+		categoryDir = System.getProperty("user.home") + "/.config/HolonGUI/Category/";
 		File autoSave = new File(autosaveDir);
 		File category = new File(categoryDir);
 		// deleteDirectory(dest);

+ 5 - 5
src/ui/controller/LoadController.java

@@ -148,7 +148,7 @@ public class LoadController {
 	private void forwardFiles(File folder, String trim) throws IOException {
 		// TODO Auto-generated method stub
 		for (File file : folder.listFiles()) {
-			File dst = new File(System.getProperty("user.home") + "/HolonGUI/" + file.getPath().replace(trim, ""));
+			File dst = new File(System.getProperty("user.home") + "/.config/HolonGUI/" + file.getPath().replace(trim, ""));
 
 			if (file.getName().contains(".json"))
 				readJson(file.getPath());
@@ -293,7 +293,7 @@ public class LoadController {
 		// TODO Auto-generated method stub
 		if (!image.contains("/HolonGUI/"))
 			return image;
-		return (System.getProperty("user.home") + image.substring(image.indexOf("/HolonGUI/"), image.length()))
+		return (System.getProperty("user.home") + "/.config" + image.substring(image.indexOf("/HolonGUI/"), image.length()))
 				.replace("\\", "/");
 	}
 
@@ -525,18 +525,18 @@ public class LoadController {
 
 		if (os.contains("windows")) {
 			ret = ret.replace("/", "\\");
-			ret = System.getProperty("user.home") + ret.substring(ret.indexOf("\\HolonGUI\\"), ret.length());
+			ret = System.getProperty("user.home") + "\\.config" + ret.substring(ret.indexOf("\\HolonGUI\\"), ret.length());
 
 		}
 		if (os.contains("mac")) {
 			// dosmth
 			ret = ret.replace("\\", "/");
-			ret = System.getProperty("user.home") + ret.substring(ret.indexOf("/HolonGUI/"), ret.length());
+			ret = System.getProperty("user.home") + "/.config" + ret.substring(ret.indexOf("/HolonGUI/"), ret.length());
 		}
 		if (os.contains("linux")) {
 			// dosmth
 			ret = ret.replace("\\", "/");
-			ret = System.getProperty("user.home") + ret.substring(ret.indexOf("/HolonGUI/"), ret.length());
+			ret = System.getProperty("user.home") + "/.config" + ret.substring(ret.indexOf("/HolonGUI/"), ret.length());
 		}
 		if (os.contains("solaris")) {
 			// dosmth

+ 5 - 5
src/ui/controller/SaveController.java

@@ -285,8 +285,8 @@ public class SaveController {
 	 */
 	private void storeData(ArchiveOutputStream stream) throws IOException {
 		// TODO Auto-generated method stub
-		File images = new File(System.getProperty("user.home") + "/HolonGUI/Images");
-		File background = new File(System.getProperty("user.home") + "/HolonGUI/BackgroundImages");
+		File images = new File(System.getProperty("user.home") + "/.config/HolonGUI/Images");
+		File background = new File(System.getProperty("user.home") + "/.config/HolonGUI/BackgroundImages");
 		addFilesToSave(images, stream);
 		addFilesToSave(background, stream);
 
@@ -498,16 +498,16 @@ public class SaveController {
 
 		if (os.contains("windows")) {
 			partition = ret.substring(0, ret.indexOf(":") + 1);
-			ret = ret.replace(System.getProperty("user.home") + "\\HolonGUI\\", "");
+			ret = ret.replace(System.getProperty("user.home") + "\\.config\\HolonGUI\\", "");
 			ret = ret.replace(partition, "");
 		}
 		if (os.contains("mac")) {
 			// dosmth
-			ret = ret.replace(System.getProperty("user.home") + "/HolonGUI/", "");
+			ret = ret.replace(System.getProperty("user.home") + "/.config/HolonGUI/", "");
 		}
 		if (os.contains("linux")) {
 			// dosmth
-			ret = ret.replace(System.getProperty("user.home") + "/HolonGUI/", "");
+			ret = ret.replace(System.getProperty("user.home") + "/.config/HolonGUI/", "");
 		}
 		if (os.contains("solaris")) {
 			// dosmth

+ 1 - 1
src/ui/view/AddObjectPopUp.java

@@ -356,7 +356,7 @@ public class AddObjectPopUp extends JDialog {
 		OutputStream outStream = null;
 		try {
 			File source = new File(filePath);
-			File dest = new File(System.getProperty("user.home") + "/HolonGUI/Images/");
+			File dest = new File(System.getProperty("user.home") + "/.config/HolonGUI/Images/");
 			dest.mkdirs();
 			dest = new File(dest, selectedFile.getName());
 			imagePath = "" + dest;

+ 3 - 3
src/ui/view/GUI.java

@@ -324,7 +324,7 @@ public class GUI<E> implements CategoryListener {
 				if (JOptionPane.showConfirmDialog(frmCyberPhysical, Languages.getLanguage()[88],
 						"Cyber Physical Systems Model", JOptionPane.YES_NO_OPTION,
 						JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) {
-					controller.deleteDirectory(new File(System.getProperty("user.home") + "/HolonGUI/Autosave"));
+					controller.deleteDirectory(new File(System.getProperty("user.home") + "/.config/HolonGUI/Autosave"));
 					System.exit(0);
 				}
 			}
@@ -1948,12 +1948,12 @@ public class GUI<E> implements CategoryListener {
 		frmCyberPhysical.getContentPane().add(timePanel, BorderLayout.SOUTH);
 
 		try {
-			controller.loadAutoSave(System.getProperty("user.home") + "/HolonGUI/Category/Category.json");
+			controller.loadAutoSave(System.getProperty("user.home") + "/.config/HolonGUI/Category/Category.json");
 		} catch (IOException e1) {
 			// TODO Auto-generated catch block
 		}
 
-		String autoPath = System.getProperty("user.home") + "/HolonGUI/Autosave/";
+		String autoPath = System.getProperty("user.home") + "/.config/HolonGUI/Autosave/";
 		File dest = new File(autoPath);
 		if (dest.listFiles().length > 1) {
 			int dialogButton = JOptionPane.YES_NO_OPTION;