OSDN Git Service

Cleanup compiler warning messages and alter backup & restore to handle new database...
[neighbornote/NeighborNote.git] / src / cx / fbn / nevernote / config / FileManager.java
index 73c1054..eda582b 100644 (file)
@@ -30,6 +30,9 @@ public class FileManager {
     private final String spellDirPath;
     private final File spellDir;
     
+    private final String spellDirPathUser;
+    private final File spellDirUser;
+    
     private final String qssDirPath;
     private final File qssDir;
 
@@ -74,6 +77,11 @@ public class FileManager {
         checkExistingReadableDir(spellDir);
         spellDirPath = slashTerminatePath(spellDir.getPath());
         
+
+        spellDirUser = new File(homeDir, "spell");
+        createDirOrCheckWriteable(spellDirUser);
+        spellDirPathUser = slashTerminatePath(spellDirUser.getPath());
+        
         xmlDir = new File(programDir, "xml");
         checkExistingReadableDir(xmlDir);
 
@@ -132,7 +140,7 @@ public class FileManager {
     }
 
     /**
-     * Get a path below the 'db' directory, using native {@link File#separator}.
+     * Get a path below the 'spell' directory, using native {@link File#separator}.
      * This will contain backslashes on Windows.
      */
     public String getSpellDirPath(String relativePath) {
@@ -143,7 +151,7 @@ public class FileManager {
      * Get a file below the 'spell' directory.
      */
     public File getSpellDirFile(String relativePath) {
-        return new File(dbDir, toPlatformPathSeparator(relativePath));
+        return new File(spellDir, toPlatformPathSeparator(relativePath));
     }
     
     /** 
@@ -154,9 +162,23 @@ public class FileManager {
     }
 
     /**
-     * Get a path below the 'spell' directory, using native {@link File#separator}.
-     * This will contain backslashes on Windows.
+     * Get a file below the 'spell' directory for user dictionaries.
      */
+    public File getSpellDirFileUser(String relativePath) {
+        return new File(spellDirUser, toPlatformPathSeparator(relativePath));
+    }
+    
+    /** 
+     * Get the spell directory for the jazzy word list (user dictionary).
+     */
+    public String getSpellDirPathUser() {
+       return spellDirPathUser;
+    }
+    
+    /**
+     * Get a path below the 'db' directory, using native {@link File#separator}.
+     * This will contain backslashes on Windows.
+     */    
     public String getDbDirPath(String relativePath) {
         return dbDirPath + toPlatformPathSeparator(relativePath);
     }
@@ -297,7 +319,8 @@ public class FileManager {
     /**
      * @throws InitializationException if non-existent, bad file permissions, or a file instead of a directory
      */
-    private static void checkExistingWriteableDir(File dir) throws InitializationException {
+    @SuppressWarnings("unused")
+       private static void checkExistingWriteableDir(File dir) throws InitializationException {
         checkExistingReadableDir(dir);
         if (!dir.canWrite()) {
             throw new InitializationException("Directory '" + dir + "' does not have write permission");