From 507fab02cc37aa9ff18ea37561560477aecafb6a Mon Sep 17 00:00:00 2001 From: fryzahh Date: Thu, 22 May 2025 22:24:42 -0400 Subject: [PATCH] Various fixes - GlobalSaveDataSystem should now have the correct save path for Linux devices. - GlobalSaveDataSystem now uses Path.DirectorySeparatorChar in its directory paths instead of "\\" - Moved the Sunken Sea ModMenu's display name to the UI localization file --- Localization/en-US/Mods.CalamityMod.UI.hjson | 1 + MainMenu/CalamityMainMenu_Sunken.cs | 2 +- MainMenu/SunkenFishBoid.cs | 1 - Systems/GlobalSaveDataSystem.cs | 15 ++++++++++----- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Localization/en-US/Mods.CalamityMod.UI.hjson b/Localization/en-US/Mods.CalamityMod.UI.hjson index 0691f76312..e2dfa709da 100644 --- a/Localization/en-US/Mods.CalamityMod.UI.hjson +++ b/Localization/en-US/Mods.CalamityMod.UI.hjson @@ -2,6 +2,7 @@ SmallWorldWarning: "[c/FF0000:SMALL WORLDS NOT SUPPORTED BY CALAMITY]" // Main Menu Name MainMenu: Calamity Style MainMenuClassic: Calamity Style - Classic +MainMenuSunken: Calamity Style - Sunken // Main UI Elements Adrenaline: Adrenaline Nanomachines: Nanomachines diff --git a/MainMenu/CalamityMainMenu_Sunken.cs b/MainMenu/CalamityMainMenu_Sunken.cs index 01fcc3dd0d..02ee492398 100644 --- a/MainMenu/CalamityMainMenu_Sunken.cs +++ b/MainMenu/CalamityMainMenu_Sunken.cs @@ -53,7 +53,7 @@ namespace CalamityMod.MainMenu /// public const string FirstTimeOpeningSunkenSeaOverhaulKey = "HasOpenedTheSunkenSeaOverhaulForTheFirstTime"; - public override string DisplayName => "Calamity Style - Sunken"; + public override string DisplayName => CalamityUtils.GetTextValue("UI.MainMenuSunken"); public override Asset Logo => ModContent.Request("CalamityMod/MainMenu/LogoSunken"); diff --git a/MainMenu/SunkenFishBoid.cs b/MainMenu/SunkenFishBoid.cs index 974a6ed905..9b7af3baab 100644 --- a/MainMenu/SunkenFishBoid.cs +++ b/MainMenu/SunkenFishBoid.cs @@ -35,7 +35,6 @@ namespace CalamityMod.MainMenu "PolypPanaseaPurple", "PolypPanaseaRadiant", "PolypPanaseaTurquoise", - "PolypPanaseaGoldCoated", "PolypPanaseaGreenCoated", "PolypPanaseaPurpleCoated", "PolypPanaseaRadiantCoated", diff --git a/Systems/GlobalSaveDataSystem.cs b/Systems/GlobalSaveDataSystem.cs index de52e65491..3f4b0116f8 100644 --- a/Systems/GlobalSaveDataSystem.cs +++ b/Systems/GlobalSaveDataSystem.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.IO; using System.Linq; using Terraria; @@ -13,21 +14,25 @@ namespace CalamityMod.Systems /// /// The directory in which all files related to globall saved data are stored. /// - internal static string GlobalSaveDataDirectoryPath => Main.SavePath + "\\CalamityModGlobalSaveData\\"; - + internal static string GlobalSaveDataDirectoryPath; /// /// The path to the text file which contains all globally saved data keys. /// - internal static string GlobalSaveDataKeysPath => Main.SavePath + "\\CalamityModGlobalSaveData\\GlobalSaveDataKeys.txt"; + internal static string GlobalSaveDataKeysPath; /// /// The path to the README file explaining the purpose of the directory. /// - internal static string READMEPath => Main.SavePath + "\\CalamityModGlobalSaveData\\README.txt"; + internal static string READMEPath; public override void OnModLoad() { + string savePathByOS = OperatingSystem.IsLinux() ? "~/.local/share/Terraria/tModloader/" : Main.SavePath; + GlobalSaveDataDirectoryPath = savePathByOS + Path.DirectorySeparatorChar + "CalamityModGlobalSaveData"; + GlobalSaveDataKeysPath = savePathByOS + Path.DirectorySeparatorChar + "CalamityModGlobalSaveData" + Path.DirectorySeparatorChar + "GlobalSaveDataKeys.txt"; + READMEPath = savePathByOS + Path.DirectorySeparatorChar + "CalamityModGlobalSaveData" + Path.DirectorySeparatorChar + "README.txt"; + // Ensure that the save data keys text file exists. If not, create a new one. if (!File.Exists(GlobalSaveDataKeysPath)) {