translation-tool: save working files in user's home directory
git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@665 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
parent
11a5489fb7
commit
ac980de693
1 changed files with 172 additions and 158 deletions
|
@ -84,7 +84,9 @@ public class TranslationTool extends JFrame
|
|||
try
|
||||
{
|
||||
String javaPath = "java";
|
||||
String classPath = "." + System.getProperty("path.separator") + "micropolisj.jar";
|
||||
String classPath = stringsModel.workingDirectory.toString()
|
||||
+ System.getProperty("path.separator")
|
||||
+ "micropolisj.jar";
|
||||
|
||||
ProcessBuilder processBuilder =
|
||||
new ProcessBuilder(javaPath,
|
||||
|
@ -194,7 +196,9 @@ public class TranslationTool extends JFrame
|
|||
new TranslationTool().setVisible(true);
|
||||
}
|
||||
|
||||
static class StringsModel extends AbstractTableModel
|
||||
}
|
||||
|
||||
class StringsModel extends AbstractTableModel
|
||||
{
|
||||
StringInfo [] strings;
|
||||
ArrayList<MyLocaleInfo> locales = new ArrayList<MyLocaleInfo>();
|
||||
|
@ -229,8 +233,15 @@ public class TranslationTool extends JFrame
|
|||
"StatusMessages"
|
||||
};
|
||||
|
||||
File workingDirectory;
|
||||
|
||||
StringsModel() throws IOException
|
||||
{
|
||||
workingDirectory = new File(
|
||||
new File(System.getProperty("user.home")),
|
||||
"micropolis-translations"
|
||||
);
|
||||
|
||||
ArrayList<StringInfo> ss = new ArrayList<StringInfo>();
|
||||
for (String f : FILES) {
|
||||
loadStrings(f, ss);
|
||||
|
@ -321,10 +332,14 @@ public class TranslationTool extends JFrame
|
|||
l.dirty = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the file in the user's working directory.
|
||||
*/
|
||||
File getPFile(String file, String localeCode)
|
||||
{
|
||||
return new File("micropolisj/"
|
||||
+file
|
||||
File d = new File(workingDirectory, "micropolisj");
|
||||
return new File(d,
|
||||
file
|
||||
+(localeCode != null ? "_"+localeCode : "")
|
||||
+".properties");
|
||||
}
|
||||
|
@ -377,4 +392,3 @@ public class TranslationTool extends JFrame
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue