mirror of
https://gitlab.com/2009scape/rt4-client.git
synced 2025-12-09 16:45:46 -07:00
Merge pull request #21 from vddCore/master
Home directory resolution fix
This commit is contained in:
commit
0043d54196
1 changed files with 22 additions and 27 deletions
|
|
@ -17,6 +17,7 @@ import java.net.InetAddress;
|
|||
import java.net.Socket;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.Hashtable;
|
||||
|
||||
|
|
@ -193,38 +194,32 @@ public final class SignLink implements Runnable {
|
|||
} catch (@Pc(67) Exception local67) {
|
||||
osVersion = "";
|
||||
}
|
||||
|
||||
String homeDirOverride = System.getProperty("clientHomeOverride");
|
||||
if (homeDirOverride != null) {
|
||||
homeDir = homeDirOverride;
|
||||
} else {
|
||||
try {
|
||||
homeDir = System.getProperty("user.home");
|
||||
if (homeDir != null) {
|
||||
homeDir = homeDir + "/";
|
||||
// 2009scape-specific behavior
|
||||
if (homeDir == null)
|
||||
homeDir = System.getProperty("user.home") + File.separatorChar;
|
||||
|
||||
if (osName.startsWith("linux")) {
|
||||
File oldCache = new File(homeDir + "/.runite_rs");
|
||||
// Use XDG_DATA_HOME if it exists, otherwise default to ~/.local/share
|
||||
homeDir = System.getenv("XDG_DATA_HOME") != null ? System.getenv("XDG_DATA_HOME") : homeDir + ".local/share";
|
||||
homeDir = homeDir + "/2009scape/";
|
||||
File newCache = new File(homeDir + "cache");
|
||||
if (oldCache.isDirectory() && !newCache.exists()) {
|
||||
Files.move(oldCache.toPath(), newCache.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
}
|
||||
String xdgHome = System.getenv("XDG_DATA_HOME");
|
||||
|
||||
if (xdgHome != null) {
|
||||
homeDir = xdgHome + "/2009scape/";
|
||||
} else {
|
||||
homeDir += ".local/share/2009scape/";
|
||||
}
|
||||
} else if (osName.startsWith("mac")) {
|
||||
homeDir += "Library/Application Support/2009scape/";
|
||||
} else if (osName.startsWith("windows")) {
|
||||
homeDir += "2009scape\\";
|
||||
}
|
||||
} catch (@Pc(86) Exception ex) {
|
||||
}
|
||||
if (homeDir == null) {
|
||||
homeDir = "~/";
|
||||
// 2009scape-specific behavior
|
||||
if (osName.startsWith("linux")) {
|
||||
File oldCache = new File(homeDir + "/.runite_rs");
|
||||
// Use XDG_DATA_HOME if it exists, otherwise default to ~/.local/share
|
||||
homeDir = System.getenv("XDG_DATA_HOME") != null ? System.getenv("XDG_DATA_HOME") : homeDir + ".local/share";
|
||||
homeDir = homeDir + "/2009scape/";
|
||||
File newCache = new File(homeDir + "cache");
|
||||
if (oldCache.isDirectory() && !newCache.exists()) {
|
||||
Files.move(oldCache.toPath(), newCache.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
this.eventQueue = Toolkit.getDefaultToolkit().getSystemEventQueue();
|
||||
} catch (@Pc(97) Throwable ex) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue