| 1 |
diff -ur src.orig/megamek/client/bot/BotConfiguration.java src/megamek/client/bot/BotConfiguration.java
|
| 2 |
--- src.orig/megamek/client/bot/BotConfiguration.java 2006-09-18 01:20:30.000000000 -0400
|
| 3 |
+++ src/megamek/client/bot/BotConfiguration.java 2006-09-18 01:26:05.000000000 -0400
|
| 4 |
@@ -9,7 +9,7 @@
|
| 5 |
|
| 6 |
static {
|
| 7 |
try {
|
| 8 |
- BotProperties.load(new FileInputStream("mmconf/bot.properties")); //$NON-NLS-1$
|
| 9 |
+ BotProperties.load(new FileInputStream(System.getProperty("user.home") + "/.megamek/mmconf/bot.properties")); //$NON-NLS-1$
|
| 10 |
} catch (Exception e) {
|
| 11 |
System.out.println("Bot properties could not be loaded, will use defaults"); //$NON-NLS-1$
|
| 12 |
}
|
| 13 |
diff -ur src.orig/megamek/client/Client.java src/megamek/client/Client.java
|
| 14 |
--- src.orig/megamek/client/Client.java 2006-09-18 01:20:30.000000000 -0400
|
| 15 |
+++ src/megamek/client/Client.java 2006-09-18 01:30:01.000000000 -0400
|
| 16 |
@@ -922,7 +922,7 @@
|
| 17 |
case Packet.COMMAND_SEND_SAVEGAME:
|
| 18 |
String sFinalFile = (String)c.getObject(0);
|
| 19 |
try {
|
| 20 |
- File sDir = new File("savegames");
|
| 21 |
+ File sDir = new File(System.getProperty("user.home") + "/.megamek/savegames");
|
| 22 |
if (!sDir.exists()) {
|
| 23 |
sDir.mkdir();
|
| 24 |
}
|
| 25 |
diff -ur src.orig/megamek/common/options/GameOptions.java src/megamek/common/options/GameOptions.java
|
| 26 |
--- src.orig/megamek/common/options/GameOptions.java 2006-09-18 01:20:30.000000000 -0400
|
| 27 |
+++ src/megamek/common/options/GameOptions.java 2006-09-18 01:26:15.000000000 -0400
|
| 28 |
@@ -41,7 +41,7 @@
|
| 29 |
public class GameOptions extends AbstractOptions implements Serializable {
|
| 30 |
static final long serialVersionUID = 5417081099101580392L;
|
| 31 |
|
| 32 |
- private static final String GAME_OPTIONS_FILE_NAME = "mmconf/gameoptions.xml"; //$NON-NLS-1$
|
| 33 |
+ private static final String GAME_OPTIONS_FILE_NAME = System.getProperty("user.home") + "/.megamek/mmconf/gameoptions.xml"; //$NON-NLS-1$
|
| 34 |
|
| 35 |
public GameOptions() {
|
| 36 |
super();
|
| 37 |
diff -ur src.orig/megamek/common/preference/ClientPreferences.java src/megamek/common/preference/ClientPreferences.java
|
| 38 |
--- src.orig/megamek/common/preference/ClientPreferences.java 2006-09-18 01:20:31.000000000 -0400
|
| 39 |
+++ src/megamek/common/preference/ClientPreferences.java 2006-09-18 02:22:17.000000000 -0400
|
| 40 |
@@ -60,7 +60,27 @@
|
| 41 |
store.setDefault(MAP_TILESET, "defaulthexset.txt");
|
| 42 |
store.setDefault(MAX_PATHFINDER_TIME, MovePath.DEFAULT_PATHFINDER_TIME_LIMIT);
|
| 43 |
store.setDefault(DATA_DIRECTORY,"data");
|
| 44 |
- store.setDefault(LOG_DIRECTORY,"logs");
|
| 45 |
+ try {
|
| 46 |
+ File homeDataDir = new File(System.getProperty("user.home") + "/.megamek");
|
| 47 |
+ if (!homeDataDir.exists()) {
|
| 48 |
+ homeDataDir.mkdir();
|
| 49 |
+ }
|
| 50 |
+ File homeConfDir = new File(System.getProperty("user.home") + "/.megamek/mmconf");
|
| 51 |
+ if (!homeConfDir.exists()) {
|
| 52 |
+ homeConfDir.mkdir();
|
| 53 |
+ }
|
| 54 |
+ File homeSaveDir = new File(System.getProperty("user.home") + "/.megamek/savegames");
|
| 55 |
+ if (!homeSaveDir.exists()) {
|
| 56 |
+ homeSaveDir.mkdir();
|
| 57 |
+ }
|
| 58 |
+ File homeLogsDir = new File(System.getProperty("user.home") + "/.megamek/logs");
|
| 59 |
+ if (!homeLogsDir.exists()) {
|
| 60 |
+ homeLogsDir.mkdir();
|
| 61 |
+ }
|
| 62 |
+ } catch (Exception e) {
|
| 63 |
+ System.err.println("Unable to create " + System.getProperty("user.home") + "/.megamek directories");
|
| 64 |
+ }
|
| 65 |
+ store.setDefault(LOG_DIRECTORY,System.getProperty("user.home") + "/.megamek/logs");
|
| 66 |
store.setDefault(MECH_DIRECTORY, store.getDefaultString(DATA_DIRECTORY) + File.separator + "mechfiles");
|
| 67 |
store.setDefault(METASERVER_NAME, "http://www.damour.info/cgi-bin/james/metaserver");
|
| 68 |
store.setDefault(GOAL_PLAYERS, 2);
|
| 69 |
diff -ur src.orig/megamek/common/preference/PreferenceManager.java src/megamek/common/preference/PreferenceManager.java
|
| 70 |
--- src.orig/megamek/common/preference/PreferenceManager.java 2006-09-18 01:20:31.000000000 -0400
|
| 71 |
+++ src/megamek/common/preference/PreferenceManager.java 2006-09-18 01:27:25.000000000 -0400
|
| 72 |
@@ -35,7 +35,7 @@
|
| 73 |
|
| 74 |
public class PreferenceManager {
|
| 75 |
|
| 76 |
- public static final String DEFAULT_CFG_FILE_NAME = "mmconf/clientsettings.xml";
|
| 77 |
+ public static final String DEFAULT_CFG_FILE_NAME = System.getProperty("user.home") + "/.megamek/mmconf/clientsettings.xml";
|
| 78 |
public static final String CFG_FILE_OPTION_NAME = "cfgfilename";
|
| 79 |
public static final String ROOT_NODE_NAME = "MegaMekSettings";
|
| 80 |
public static final String CLIENT_SETTINGS_STORE_NAME = "ClientSettings";
|
| 81 |
diff -ur src.orig/megamek/MegaMek.java src/megamek/MegaMek.java
|
| 82 |
--- src.orig/megamek/MegaMek.java 2006-09-18 01:20:30.000000000 -0400
|
| 83 |
+++ src/megamek/MegaMek.java 2006-09-18 01:29:28.000000000 -0400
|
| 84 |
@@ -361,7 +361,7 @@
|
| 85 |
|
| 86 |
public void loadGame() {
|
| 87 |
FileDialog fd = new FileDialog(frame, Messages.getString("MegaMek.SaveGameDialog.title"), FileDialog.LOAD); //$NON-NLS-1$
|
| 88 |
- fd.setDirectory("savegames"); //$NON-NLS-1$
|
| 89 |
+ fd.setDirectory(System.getProperty("user.home") + "/.megamek/savegames"); //$NON-NLS-1$
|
| 90 |
// limit file-list to savedgames only
|
| 91 |
fd.setFilenameFilter(new FilenameFilter() {
|
| 92 |
public boolean accept(File dir, String name) {
|
| 93 |
diff -ur src.orig/megamek/server/Server.java src/megamek/server/Server.java
|
| 94 |
--- src.orig/megamek/server/Server.java 2006-09-18 01:20:30.000000000 -0400
|
| 95 |
+++ src/megamek/server/Server.java 2006-09-18 01:30:41.000000000 -0400
|
| 96 |
@@ -673,7 +673,7 @@
|
| 97 |
if (!sFinalFile.endsWith(".sav")) {
|
| 98 |
sFinalFile = sFile + ".sav";
|
| 99 |
}
|
| 100 |
- sFinalFile = "savegames" + File.separator + sFinalFile;
|
| 101 |
+ sFinalFile = System.getProperty("user.home") + "/.megamek/savegames" + File.separator + sFinalFile;
|
| 102 |
File f = new File(sFinalFile);
|
| 103 |
try {
|
| 104 |
ObjectInputStream ois = new ObjectInputStream(
|
| 105 |
@@ -699,7 +699,7 @@
|
| 106 |
sFinalFile = sFile + ".sav";
|
| 107 |
}
|
| 108 |
try {
|
| 109 |
- File sDir = new File("savegames");
|
| 110 |
+ File sDir = new File(System.getProperty("user.home") + "/.megamek/savegames");
|
| 111 |
if (!sDir.exists()) {
|
| 112 |
sDir.mkdir();
|
| 113 |
}
|