make cardPicsDir separately configurable

This commit is contained in:
myk
2013-03-10 01:48:02 +00:00
parent 0472bb36b9
commit 3873d9852f
2 changed files with 15 additions and 8 deletions

View File

@@ -33,9 +33,11 @@ import org.apache.commons.lang3.tuple.Pair;
public class ForgeProfileProperties {
public final String userDir;
public final String cacheDir;
public final String cardPicsDir;
private final String _USER_DIR_KEY = "userDir";
private final String _CACHE_DIR_KEY = "cacheDir";
private final String _USER_DIR_KEY = "userDir";
private final String _CACHE_DIR_KEY = "cacheDir";
private final String _CARD_PICS_DIR_KEY = "cardPicsDir";
public ForgeProfileProperties(String filename) {
Properties props = new Properties();
@@ -60,8 +62,12 @@ public class ForgeProfileProperties {
propUserDir += propUserDir.endsWith("/") || propUserDir.endsWith(File.pathSeparator) ? "" : "/";
propCacheDir += propCacheDir.endsWith("/") || propCacheDir.endsWith(File.pathSeparator) ? "" : "/";
userDir = propUserDir;
cacheDir = propCacheDir;
String propCardPicsDir = props.getProperty(_CARD_PICS_DIR_KEY, propCacheDir + "pics/cards/");
propCardPicsDir += propCardPicsDir.endsWith("/") || propCardPicsDir.endsWith(File.pathSeparator) ? "" : "/";
userDir = propUserDir;
cacheDir = propCacheDir;
cardPicsDir = propCardPicsDir;
}
// returns a pair <userDir, cacheDir>

View File

@@ -49,10 +49,12 @@ public final class NewConstants {
// data tree roots
private static final String _USER_DIR;
private static final String _CACHE_DIR;
public static final String CACHE_CARD_PICS_DIR;
static {
ForgeProfileProperties profileProps = new ForgeProfileProperties(PROFILE_FILE);
_USER_DIR = profileProps.userDir;
_CACHE_DIR = profileProps.cacheDir;
_USER_DIR = profileProps.userDir;
_CACHE_DIR = profileProps.cacheDir;
CACHE_CARD_PICS_DIR = profileProps.cardPicsDir;
}
// data that is only in the profile dirs
@@ -78,9 +80,8 @@ public final class NewConstants {
public static final FileLocation EDITOR_LAYOUT_FILE = new FileLocation(_DEFAULTS_DIR, _USER_PREFS_DIR, "editor.xml");
// data that is only in the cached dir
private static final String _DB_DIR = _CACHE_DIR + "db/";
private static final String _DB_DIR = _CACHE_DIR + "db/";
private static final String _PICS_DIR = _CACHE_DIR + "pics/";
public static final String CACHE_CARD_PICS_DIR = _PICS_DIR + "cards/";
public static final String CACHE_TOKEN_PICS_DIR = _PICS_DIR + "tokens/";
public static final String CACHE_ICON_PICS_DIR = _PICS_DIR + "icons/";
public static final String CACHE_BOOSTER_PICS_DIR = _PICS_DIR + "boosters/";