v1.3.0: fixed desktop backend assuming XDG_DATA_HOME contained a slash

This commit is contained in:
Evan Debenham
2022-06-10 19:29:46 -04:00
parent cfba8f41e0
commit 4faa319bcf

View File

@@ -143,12 +143,12 @@ public class DesktopLauncher {
basePath = "Library/Application Support/Shattered Pixel Dungeon/";
} else if (SharedLibraryLoader.isLinux) {
String XDGHome = System.getenv().get("XDG_DATA_HOME");
if (XDGHome == null) XDGHome = ".local/share/";
basePath = XDGHome + ".shatteredpixel/shattered-pixel-dungeon/";
if (XDGHome == null) XDGHome = ".local/share";
basePath = XDGHome + "/.shatteredpixel/shattered-pixel-dungeon/";
//copy over files from old linux save DIR, pre-1.2.0
FileHandle oldBase = new Lwjgl3FileHandle(".shatteredpixel/shattered-pixel-dungeon/", Files.FileType.External);
FileHandle newBase = new Lwjgl3FileHandle(XDGHome + ".shatteredpixel/shattered-pixel-dungeon/", Files.FileType.External);
FileHandle newBase = new Lwjgl3FileHandle(basePath, Files.FileType.External);
if (oldBase.exists()){
if (!newBase.exists()) {
oldBase.copyTo(newBase.parent());