Teh-Hai Julian Zheng 7 лет назад
Родитель
Сommit
0434be59f1
2 измененных файлов с 15 добавлено и 14 удалено
  1. 3 1
      src/ui/controller/SaveController.java
  2. 12 13
      src/ui/view/GUI.java

+ 3 - 1
src/ui/controller/SaveController.java

@@ -271,7 +271,7 @@ public class SaveController {
 	 */
 	private void storeData(ArchiveOutputStream stream) throws IOException {
 		// TODO Auto-generated method stub
-
+		System.out.println(System.getProperty("user.home"));
 		File images = new File(System.getProperty("user.home") + "/HolonGUI/Images");
 		File background = new File(System.getProperty("user.home") + "/HolonGUI/BackgroundImages");
 		addFilesToSave(images, stream);
@@ -428,7 +428,9 @@ public class SaveController {
 	 */
 	private void addFileToSave(File src, ArchiveOutputStream stream, boolean dir) throws IOException {
 		String entryName = (dir == true ? src.getCanonicalPath() : src.getName());
+		entryName = entryName.replace("C:", "");
 		entryName = entryName.replace(System.getProperty("user.home") + "/HolonGUI/", "");
+		
 
 		ZipArchiveEntry entry = new ZipArchiveEntry(entryName);
 		stream.putArchiveEntry(entry);

+ 12 - 13
src/ui/view/GUI.java

@@ -1698,19 +1698,19 @@ public class GUI<E> implements CategoryListener {
 					if (fileChooser.getFileFilter().equals(holonFilter)) {
 						if (!file.contains("."))
 							file += ".holon";
-						if (!file.endsWith(".holon")) {
-							String suffix = file.substring(file.lastIndexOf("."), file.length());
-							String[] options = new String[] { "keep .holon", "use " + suffix };
+					}
+					if (!file.endsWith(".holon")) {
+						String suffix = file.substring(file.lastIndexOf("."), file.length());
+						String[] options = new String[] { "keep .holon", "use " + suffix };
 
-							JLabel message = new JLabel(
-									"Are you sure to use the extension \"" + suffix + "\" instead of \".holon\"?");
+						JLabel message = new JLabel(
+								"Are you sure to use the extension \"" + suffix + "\" instead of \".holon\"?");
 
-							int response = JOptionPane.showOptionDialog(null, message, "", JOptionPane.DEFAULT_OPTION,
-									JOptionPane.QUESTION_MESSAGE, null, options, options[1]);
+						int response = JOptionPane.showOptionDialog(null, message, "", JOptionPane.DEFAULT_OPTION,
+								JOptionPane.QUESTION_MESSAGE, null, options, options[1]);
 
-							if (response == 0)
-								file = file.replace(suffix, ".holon");
-						}
+						if (response == 0)
+							file = file.replace(suffix, ".holon");
 					}
 
 					try {
@@ -1907,7 +1907,7 @@ public class GUI<E> implements CategoryListener {
 		tableHolonElementScrollPane.setBorder(null);
 
 		frmCyberPhysical.getContentPane().add(timePanel, BorderLayout.SOUTH);
-		
+
 		try {
 			controller.loadAutoSave(System.getProperty("user.home") + "/HolonGUI/Category/Category.json");
 		} catch (IOException e1) {
@@ -1932,8 +1932,7 @@ public class GUI<E> implements CategoryListener {
 				setUpAutoSave(dest);
 			}
 		}
-		
-		
+
 		canvasSP.addComponentListener(new ComponentAdapter() {
 			@Override
 			public void componentResized(ComponentEvent e) {