v1.2.0: updated base save path for linux and removed old prefs convert
This commit is contained in:
@@ -137,14 +137,20 @@ public class DesktopLauncher {
|
|||||||
} else if (SharedLibraryLoader.isMac) {
|
} else if (SharedLibraryLoader.isMac) {
|
||||||
basePath = "Library/Application Support/Shattered Pixel Dungeon/";
|
basePath = "Library/Application Support/Shattered Pixel Dungeon/";
|
||||||
} else if (SharedLibraryLoader.isLinux) {
|
} else if (SharedLibraryLoader.isLinux) {
|
||||||
basePath = ".shatteredpixel/shattered-pixel-dungeon/";
|
String XDGHome = System.getenv().get("XDG_DATA_HOME");
|
||||||
}
|
if (XDGHome == null) XDGHome = ".local/share/";
|
||||||
|
basePath = XDGHome + ".shatteredpixel/shattered-pixel-dungeon/";
|
||||||
|
|
||||||
//copy over prefs from old file location from legacy desktop codebase
|
//copy over files from old linux save DIR, pre-1.2.0
|
||||||
FileHandle oldPrefs = new Lwjgl3FileHandle(basePath + "pd-prefs", Files.FileType.External);
|
FileHandle oldBase = new Lwjgl3FileHandle(".shatteredpixel/", Files.FileType.External);
|
||||||
FileHandle newPrefs = new Lwjgl3FileHandle(basePath + SPDSettings.DEFAULT_PREFS_FILE, Files.FileType.External);
|
FileHandle newBase = new Lwjgl3FileHandle(XDGHome + ".shatteredpixel/", Files.FileType.External);
|
||||||
if (oldPrefs.exists() && !newPrefs.exists()){
|
if (oldBase.exists()){
|
||||||
oldPrefs.copyTo(newPrefs);
|
if (newBase.exists()){
|
||||||
|
oldBase.deleteDirectory();
|
||||||
|
} else {
|
||||||
|
oldBase.moveTo(newBase);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
config.setPreferencesConfig( basePath, Files.FileType.External );
|
config.setPreferencesConfig( basePath, Files.FileType.External );
|
||||||
|
|||||||
Reference in New Issue
Block a user