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
|
try
|
||||||
{
|
{
|
||||||
String javaPath = "java";
|
String javaPath = "java";
|
||||||
String classPath = "." + System.getProperty("path.separator") + "micropolisj.jar";
|
String classPath = stringsModel.workingDirectory.toString()
|
||||||
|
+ System.getProperty("path.separator")
|
||||||
|
+ "micropolisj.jar";
|
||||||
|
|
||||||
ProcessBuilder processBuilder =
|
ProcessBuilder processBuilder =
|
||||||
new ProcessBuilder(javaPath,
|
new ProcessBuilder(javaPath,
|
||||||
|
@ -194,8 +196,10 @@ public class TranslationTool extends JFrame
|
||||||
new TranslationTool().setVisible(true);
|
new TranslationTool().setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static class StringsModel extends AbstractTableModel
|
}
|
||||||
{
|
|
||||||
|
class StringsModel extends AbstractTableModel
|
||||||
|
{
|
||||||
StringInfo [] strings;
|
StringInfo [] strings;
|
||||||
ArrayList<MyLocaleInfo> locales = new ArrayList<MyLocaleInfo>();
|
ArrayList<MyLocaleInfo> locales = new ArrayList<MyLocaleInfo>();
|
||||||
|
|
||||||
|
@ -229,8 +233,15 @@ public class TranslationTool extends JFrame
|
||||||
"StatusMessages"
|
"StatusMessages"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
File workingDirectory;
|
||||||
|
|
||||||
StringsModel() throws IOException
|
StringsModel() throws IOException
|
||||||
{
|
{
|
||||||
|
workingDirectory = new File(
|
||||||
|
new File(System.getProperty("user.home")),
|
||||||
|
"micropolis-translations"
|
||||||
|
);
|
||||||
|
|
||||||
ArrayList<StringInfo> ss = new ArrayList<StringInfo>();
|
ArrayList<StringInfo> ss = new ArrayList<StringInfo>();
|
||||||
for (String f : FILES) {
|
for (String f : FILES) {
|
||||||
loadStrings(f, ss);
|
loadStrings(f, ss);
|
||||||
|
@ -321,10 +332,14 @@ public class TranslationTool extends JFrame
|
||||||
l.dirty = true;
|
l.dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the file in the user's working directory.
|
||||||
|
*/
|
||||||
File getPFile(String file, String localeCode)
|
File getPFile(String file, String localeCode)
|
||||||
{
|
{
|
||||||
return new File("micropolisj/"
|
File d = new File(workingDirectory, "micropolisj");
|
||||||
+file
|
return new File(d,
|
||||||
|
file
|
||||||
+(localeCode != null ? "_"+localeCode : "")
|
+(localeCode != null ? "_"+localeCode : "")
|
||||||
+".properties");
|
+".properties");
|
||||||
}
|
}
|
||||||
|
@ -376,5 +391,4 @@ public class TranslationTool extends JFrame
|
||||||
l.dirty = false;
|
l.dirty = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue