From d42c54af5f595138789822295afd895b63769968 Mon Sep 17 00:00:00 2001 From: Nat-the-Chicken <62949814+Nat-the-Chicken@users.noreply.github.com> Date: Wed, 8 Mar 2023 14:52:33 -0500 Subject: [PATCH 1/2] Add checks for Steam Linux install locations Added checks for a few common locations where Steam might install the game on Linux, checking a Linux-specific environment variable to get the user directory. --- src/main/java/lmr/randomizer/Settings.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/main/java/lmr/randomizer/Settings.java b/src/main/java/lmr/randomizer/Settings.java index 8b35288..446687c 100644 --- a/src/main/java/lmr/randomizer/Settings.java +++ b/src/main/java/lmr/randomizer/Settings.java @@ -156,11 +156,26 @@ private Settings() { minRandomRemovedItems = 0; maxRandomRemovedItems = 0; + // Check for Linux Steam installs. The "HOME" environment variable typically only exists on Linux and returns "/home/[user]". + // If requested on Windows it'll return null, hence the null check. + // The Linux GOG check could possibly be moved up here as well. + // Added by Nat the Chicken, March 2023. + String linuxUserPath = System.getenv("HOME"); + if (linuxUserPath != null) { + for (String filename : Arrays.asList(linuxUserPath + "/.steam/debian-installation/steamapps/common/La-Mulana", //the usual location + linuxUserPath + "/.steam/root/steamapps/common/La-Mulana", //this is usually a symlink to the real install and serves as a catch-all + linuxUserPath + "/.local/share/Steam/steamapps/common/La-Mulana")) { //just in case they have an ANCIENT installation + if (new File(filename).exists()) { + laMulanaBaseDir = filename; + break; + } + } + } + for (String filename : Arrays.asList("C:\\Games\\La-Mulana Remake 1.3.3.1", "C:\\GOG Games\\La-Mulana", "C:\\GOG Games\\La-Mulana", "C:\\Steam\\steamapps\\common\\La-Mulana", "C:\\Program Files (x86)\\Steam\\steamapps\\common\\La-Mulana", "C:\\Program Files\\Steam\\steamapps\\common\\La-Mulana", "C:\\Program Files (x86)\\GOG Galaxy\\Games\\La Mulana", - "C:\\Program Files (x86)\\GOG.com\\La-Mulana" - /* Steam on Linux path? */)) { + "C:\\Program Files (x86)\\GOG.com\\La-Mulana")) { if (new File(filename).exists()) { laMulanaBaseDir = filename; break; From 019b633ae252b00a976041890ece254e59806d74 Mon Sep 17 00:00:00 2001 From: Nat-the-Chicken <62949814+Nat-the-Chicken@users.noreply.github.com> Date: Wed, 8 Mar 2023 18:44:31 -0500 Subject: [PATCH 2/2] Formatting change to original commit Just a tiny little inconsequential change because I didn't like how I used the linuxUserPath variable before. (Re-tested anyway to avoid stupid mistakes.) Feel free to combine with the original commit. --- src/main/java/lmr/randomizer/Settings.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/lmr/randomizer/Settings.java b/src/main/java/lmr/randomizer/Settings.java index 446687c..55d2647 100644 --- a/src/main/java/lmr/randomizer/Settings.java +++ b/src/main/java/lmr/randomizer/Settings.java @@ -162,11 +162,11 @@ private Settings() { // Added by Nat the Chicken, March 2023. String linuxUserPath = System.getenv("HOME"); if (linuxUserPath != null) { - for (String filename : Arrays.asList(linuxUserPath + "/.steam/debian-installation/steamapps/common/La-Mulana", //the usual location - linuxUserPath + "/.steam/root/steamapps/common/La-Mulana", //this is usually a symlink to the real install and serves as a catch-all - linuxUserPath + "/.local/share/Steam/steamapps/common/La-Mulana")) { //just in case they have an ANCIENT installation - if (new File(filename).exists()) { - laMulanaBaseDir = filename; + for (String filename : Arrays.asList("/.steam/debian-installation/steamapps/common/La-Mulana", //the usual location + "/.steam/root/steamapps/common/La-Mulana", //this is usually a symlink to the real install and serves as a catch-all + "/.local/share/Steam/steamapps/common/La-Mulana")) { //just in case they have an ANCIENT installation + if (new File(linuxUserPath + filename).exists()) { + laMulanaBaseDir = linuxUserPath + filename; break; } }