OSDN Git Service

Merge Hiroshi's changes.
[neighbornote/NeighborNote.git] / src / cx / fbn / nevernote / config / FileManager.java
index b444d71..cff1b21 100644 (file)
@@ -38,6 +38,9 @@ public class FileManager {
 
     private final File xmlDir;
 
+    private final String translateDirPath;
+    private final File translateDir;
+
     /**
      * Check or create the db, log and res directories.
      *
@@ -74,6 +77,10 @@ public class FileManager {
         xmlDir = new File(programDir, "xml");
         checkExistingReadableDir(xmlDir);
 
+        translateDir = new File(programDir, "translate");
+        checkExistingReadableDir(translateDir);
+        translateDirPath= slashTerminatePath(translateDir.getPath());
+
         // Read-write
         dbDir = new File(homeDir, "db");
         createDirOrCheckWriteable(dbDir);
@@ -207,6 +214,14 @@ public class FileManager {
         return new File(xmlDir, toPlatformPathSeparator(relativePath));
     }
 
+    /**
+     * Get a path below the 'translate' directory, using native {@link File#separator}.
+     * This will contain backslashes on Windows.
+     */
+    public String getTranslateFilePath(String relativePath) {
+        return translateDirPath + toPlatformPathSeparator(relativePath);
+    }
+
     private static String toPlatformPathSeparator(String relativePath) {
        // Sometimes a space in the file name comes across as a %20.  This is to put it back as a space.
        relativePath = relativePath.replace("%20", " ");