Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/User-Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ If you are using the Mac OS X version of Forge then you will find the forge.prof
/Contents/Resources/Java/
and you will find the file.

The userDir's location may be changed by setting the environment variable "FORGE_USER_DIR" to the desired path. Likewise, the cache dir can be changed using the
"FORGE_CACHE_DIR" environment variable.

## Import Data
If you have a directory full of deck files, you can use the Import Data dialog to copy or move them to the appropriate directory. The dialog gives you a full listing of all file copy/move operations, so you can see what will happen before you click 'Start Import'.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,29 +172,52 @@ private static Pair<String, String> getDefaultDirs() {

final String fallbackDataDir = TextUtil.concatNoSpace(homeDir, "/.forge");

if (StringUtils.containsIgnoreCase(osName, "windows")) {
// the split between appdata and localappdata on windows is relatively recent. If
// localappdata is not defined, use appdata for both. and if appdata is not defined,
// fall back to a linux-style dot dir in the home directory
// Data Dir
String dataDir = null;
if (System.getenv().containsKey("FORGE_USER_DIR")) {
dataDir = System.getenv().get("FORGE_USER_DIR");
}
else if (StringUtils.containsIgnoreCase(osName, "windows")) {
// If appdata is not defined, fall back to a linux-style dot dir in the home directory
String appRoot = System.getenv().get("APPDATA");
if (StringUtils.isEmpty(appRoot)) {
appRoot = fallbackDataDir;
}
dataDir = appRoot + File.separator + "Forge";
}
else if (StringUtils.containsIgnoreCase(osName, "mac os x")) {
dataDir = TextUtil.concatNoSpace(homeDir, "/Library/Application Support/Forge");
}
else {
// Linux and everything else
dataDir = fallbackDataDir;
}

// Cache Dir
String cacheDir = null;
if (System.getenv().containsKey("FORGE_CACHE_DIR")) {
cacheDir = System.getenv().get("FORGE_CACHE_DIR");
}
else if (StringUtils.containsIgnoreCase(osName, "windows")) {
// the split between appdata and localappdata on windows is relatively recent. If
// localappdata is not defined, use a subdirectory of the data dir
String cacheRoot = System.getenv().get("LOCALAPPDATA");
if (StringUtils.isEmpty(cacheRoot)) {
cacheRoot = appRoot;
cacheDir = dataDir + File.separator + "Cache";
}
else {
cacheDir = cacheRoot + File.separator + "Forge" + File.separator + "Cache";
}
// the cache dir is Forge/Cache instead of just Forge since appRoot and cacheRoot might be the
// same directory on windows and we need to distinguish them.
return Pair.of(appRoot + File.separator + "Forge", cacheRoot + File.separator + "Forge" + File.separator + "Cache");
}
else if (StringUtils.containsIgnoreCase(osName, "mac os x")) {
return Pair.of(TextUtil.concatNoSpace(homeDir, "/Library/Application Support/Forge"),
TextUtil.concatNoSpace(homeDir, "/Library/Caches/Forge"));
cacheDir = TextUtil.concatNoSpace(homeDir, "/Library/Caches/Forge");
}
else {
// Linux and everything else
cacheDir = TextUtil.concatNoSpace(homeDir, "/.cache/forge");
}

// Linux and everything else
return Pair.of(fallbackDataDir, TextUtil.concatNoSpace(homeDir, "/.cache/forge"));
return Pair.of(dataDir, cacheDir);
}

private static void save() {
Expand Down