[MOBY-guts] biomoby commit

Paul Gordon gordonp at dev.open-bio.org
Sat Jun 9 22:00:27 UTC 2007


gordonp
Sat Jun  9 18:00:27 EDT 2007
Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util
In directory dev.open-bio.org:/tmp/cvs-serv5291/src/main/ca/ucalgary/seahawk/util

Modified Files:
	SeahawkOptions.java 
Log Message:
Moved settings from working dir to home dir, other minor changes
moby-live/Java/src/main/ca/ucalgary/seahawk/util SeahawkOptions.java,1.2,1.3
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/SeahawkOptions.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/SeahawkOptions.java	2007/06/08 20:30:21	1.2
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/SeahawkOptions.java	2007/06/09 22:00:27	1.3
@@ -17,10 +17,11 @@
     public static final String REGISTRY_SYNONYM_PROP = "registrySynonym";
     public static final String REGISTRY_ENDPOINT_PROP = "registryEndpoint";
     public static final String REGISTRY_NAMESPACE_PROP = "registryNamespace";
-    public static final String ANON_REGISTRY_SYNONYM = "anonymous";
+    public static final String CUSTOM_REGISTRY_SYNONYM = "custom";
 
     public static final String PROPS_FILE_NAME = "seahawkUserPrefs.xml";
-    public static final String PROPS_FILE_COMMENT = "This is the only file Seahawk stores on your system indefinitely.  If you delete it, your preferences will be reset the next time you run Seahawk.";
+    public static final String PROPS_FILE_COMMENT = "This is the only file Seahawk stores on your system indefinitely.\n" +
+	"If you delete it, your preferences will be reset the next time you run Seahawk.";
     public static final String PROPS_FILE_ENCODING = "UTF-8";
     public static final String PROPS_FILE_SYS_PROPERTY = "seahawk.prefs";
 
@@ -199,7 +200,7 @@
 				   "default registry instead.");
 	    }
 	    else{
-		setRegistry(new Registry(ANON_REGISTRY_SYNONYM, regEndpoint, regNamespace));
+		setRegistry(new Registry(CUSTOM_REGISTRY_SYNONYM, regEndpoint, regNamespace));
 	    }
 	}
     }
@@ -223,8 +224,10 @@
 
     /**
      * Saves the current values of the preferences to a default location that restoreSettings() will use too.
+     *
+     * @return true of the save was successful, false otherwise
      */
-    public static void saveSettings(){
+    public static boolean saveSettings(){
 	File defaultsFile = getDefaultsFile();
 	File defaultsParentFile = defaultsFile.getParentFile();
 	if(defaultsParentFile != null &&
@@ -234,7 +237,7 @@
 				   ") is not writeable because its parent directory " +
 				   "could not be created, preferences will be lost when " +
 				   "Seahawk terminates.");
-		return;
+		return false;
 	    }
 	}
 	if(defaultsFile.isDirectory()){
@@ -242,13 +245,13 @@
 			       ") is not writeable because a directory with the same " +
 			       "name already exists, preferences will be lost when " +
 			       "Seahawk terminates.");
-	    return;
+	    return false;
 	}
-	if(!defaultsFile.canWrite()){
+	if(defaultsFile.exists() && !defaultsFile.canWrite()){
 	    System.err.println("Warning: the preferences file (" + defaultsFile + 
 			       ") is not writeable, preferences will be lost when " +
 			       "Seahawk terminates.");
-	    return;
+	    return false;
 	}
 
 	try{
@@ -258,14 +261,16 @@
 	    e.printStackTrace();
 	    System.err.println("Warning: could not save preferences (file " + defaultsFile + 
 			       "), they will be lost when Seahawk terminates.");
+	    return false;
 	}
+	return true;
     }
 
     /**
      * @return the file system location where preferences are stored (whether the file currently exists or not)
      */
     public static File getDefaultsFile(){
-	return new File(System.getProperty("user.dir"), PROPS_FILE_NAME);
+	return new File(System.getProperty("user.home"), PROPS_FILE_NAME);
     }
 
     /**




More information about the MOBY-guts mailing list