mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
allow for custom deck directory paths
This adds support for two additional configuration options to the forge.profile.properties file: * decksDir * decksConstructedDir The first sets the desired path for all decks. The second sets the desired path specifically for constructed decks. This allows users to reference an external directory that may be synced between multiple users or systems by an external (to forge) mechanism. Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
This commit is contained in:
@@ -187,12 +187,16 @@ public final class ForgeConstants {
|
||||
public static final String CACHE_CARD_PICS_DIR;
|
||||
public static final Map<String, String> CACHE_CARD_PICS_SUBDIR;
|
||||
public static final int SERVER_PORT_NUMBER;
|
||||
public static final String DECK_BASE_DIR;
|
||||
public static final String DECK_CONSTRUCTED_DIR;
|
||||
static {
|
||||
ForgeProfileProperties.load();
|
||||
USER_DIR = ForgeProfileProperties.getUserDir();
|
||||
CACHE_DIR = ForgeProfileProperties.getCacheDir();
|
||||
CACHE_CARD_PICS_DIR = ForgeProfileProperties.getCardPicsDir();
|
||||
CACHE_CARD_PICS_SUBDIR = Collections.unmodifiableMap(ForgeProfileProperties.getCardPicsSubDirs());
|
||||
DECK_BASE_DIR = ForgeProfileProperties.getDecksDir();
|
||||
DECK_CONSTRUCTED_DIR = ForgeProfileProperties.getDecksConstructedDir();
|
||||
SERVER_PORT_NUMBER = ForgeProfileProperties.getServerPort();
|
||||
}
|
||||
|
||||
@@ -203,9 +207,7 @@ public final class ForgeConstants {
|
||||
public static final String USER_PREFS_DIR = USER_DIR + "preferences" + PATH_SEPARATOR;
|
||||
public static final String USER_GAMES_DIR = USER_DIR + "games" + PATH_SEPARATOR;
|
||||
public static final String LOG_FILE = USER_DIR + "forge.log";
|
||||
public static final String DECK_BASE_DIR = USER_DIR + "decks" + PATH_SEPARATOR;
|
||||
public static final String ACHIEVEMENTS_DIR = USER_DIR + "achievements" + PATH_SEPARATOR;
|
||||
public static final String DECK_CONSTRUCTED_DIR = DECK_BASE_DIR + "constructed" + PATH_SEPARATOR;
|
||||
public static final String DECK_DRAFT_DIR = DECK_BASE_DIR + "draft" + PATH_SEPARATOR;
|
||||
public static final String DECK_WINSTON_DIR = DECK_BASE_DIR + "winston" + PATH_SEPARATOR;
|
||||
public static final String DECK_SEALED_DIR = DECK_BASE_DIR + "sealed" + PATH_SEPARATOR;
|
||||
|
||||
@@ -41,12 +41,16 @@ public class ForgeProfileProperties {
|
||||
private static String cacheDir;
|
||||
private static String cardPicsDir;
|
||||
private static Map<String, String> cardPicsSubDirs;
|
||||
private static String decksDir;
|
||||
private static String decksConstructedDir;
|
||||
private static int serverPort;
|
||||
|
||||
private static final String USER_DIR_KEY = "userDir";
|
||||
private static final String CACHE_DIR_KEY = "cacheDir";
|
||||
private static final String CARD_PICS_DIR_KEY = "cardPicsDir";
|
||||
private static final String CARD_PICS_SUB_DIRS_KEY = "cardPicsSubDirs";
|
||||
private static final String DECKS_DIR_KEY = "decksDir";
|
||||
private static final String DECKS_CONSTRUCTED_DIR_KEY = "decksConstructedDir";
|
||||
private static final String SERVER_PORT_KEY = "serverPort";
|
||||
|
||||
private ForgeProfileProperties() {
|
||||
@@ -69,6 +73,8 @@ public class ForgeProfileProperties {
|
||||
cacheDir = getDir(props, CACHE_DIR_KEY, defaults.getRight());
|
||||
cardPicsDir = getDir(props, CARD_PICS_DIR_KEY, cacheDir + "pics" + File.separator + "cards" + File.separator);
|
||||
cardPicsSubDirs = getMap(props, CARD_PICS_SUB_DIRS_KEY);
|
||||
decksDir = getDir(props, DECKS_DIR_KEY, userDir + "decks" + File.separator);
|
||||
decksConstructedDir = getDir(props, DECKS_CONSTRUCTED_DIR_KEY, decksDir + "constructed" + File.separator);;
|
||||
serverPort = getInt(props, SERVER_PORT_KEY, 36743); // "Forge" using phone keypad
|
||||
|
||||
//ensure directories exist
|
||||
@@ -109,6 +115,18 @@ public class ForgeProfileProperties {
|
||||
return cardPicsSubDirs;
|
||||
}
|
||||
|
||||
public static String getDecksDir() { return decksDir; }
|
||||
public static void setDecksDir(final String decksDir0) {
|
||||
decksDir = decksDir0;
|
||||
save();
|
||||
}
|
||||
|
||||
public static String getDecksConstructedDir() { return decksConstructedDir; }
|
||||
public static void setDecksConstructedDir(final String decksConstructedDir0) {
|
||||
decksConstructedDir = decksConstructedDir0;
|
||||
save();
|
||||
}
|
||||
|
||||
public static int getServerPort() {
|
||||
return serverPort;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user