From 474f04869cbf04a95f2cbb32fddddb63cfac69b4 Mon Sep 17 00:00:00 2001 From: Yako Date: Tue, 11 Nov 2025 11:33:15 +0100 Subject: [PATCH] allow for no custom charmap to be present --- DS_Map/Resources/CharMaps/CharMapManager.cs | 36 +++++---------------- 1 file changed, 8 insertions(+), 28 deletions(-) diff --git a/DS_Map/Resources/CharMaps/CharMapManager.cs b/DS_Map/Resources/CharMaps/CharMapManager.cs index 46c1781..042c6fa 100644 --- a/DS_Map/Resources/CharMaps/CharMapManager.cs +++ b/DS_Map/Resources/CharMaps/CharMapManager.cs @@ -179,45 +179,25 @@ namespace DSPRE.CharMaps public static bool IsCustomMapOutdated() { // Check if custom charmap file exists - if (!File.Exists(customCharmapFilePath)) + if (File.Exists(customCharmapFilePath)) { - AppLogger.Warn($"No custom charmap found at: {customCharmapFilePath}"); - + // Both files exist, compare versions try { - // Ensure directory exists - if (!Directory.Exists(Program.DspreDataPath)) - { - Directory.CreateDirectory(Program.DspreDataPath); - } + var defaultVersion = GetCharMapVersion(charmapFilePath); + var customVersion = GetCharMapVersion(customCharmapFilePath); - // Copy default charmap to custom path - File.Copy(charmapFilePath, customCharmapFilePath, false); - AppLogger.Info($"Created custom charmap from default at: {customCharmapFilePath}"); - - // Since we just created it, it's not outdated - return false; + return customVersion < defaultVersion; } catch (Exception ex) { - AppLogger.Error($"Failed to create custom charmap: {ex.Message}"); - return false; // Don't treat as outdated if creation failed + AppLogger.Error($"Error comparing charmap versions: {ex.Message}"); + return false; // Don't treat as outdated if comparison failed } } - // Both files exist, compare versions - try - { - var defaultVersion = GetCharMapVersion(charmapFilePath); - var customVersion = GetCharMapVersion(customCharmapFilePath); + return false; // Custom charmap does not exist, so not outdated - return customVersion < defaultVersion; - } - catch (Exception ex) - { - AppLogger.Error($"Error comparing charmap versions: {ex.Message}"); - return false; // Don't treat as outdated if comparison failed - } } ///