From cf9ec0bd4a746954153534af6b14e3945caac397 Mon Sep 17 00:00:00 2001 From: Henry Cheng <39224097+jazzysoggy@users.noreply.github.com> Date: Wed, 26 Oct 2022 02:19:44 -0400 Subject: [PATCH] Fix no overwrite alert on Windows if there are capitalization differences (#18375) --- distribution/changelog.txt | 1 + src/openrct2-ui/windows/LoadSave.cpp | 15 ++------------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 3ebf871beb..24b78c8852 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -18,6 +18,7 @@ - Fix: [#18122] Ghosts count towards “Great scenery!” guest thought. - Fix: [#18134] Underground on-ride photo section partially clips through adjacent terrain edge. - Fix: [#18257] Guests ‘waiting’ on extended railway crossings. +- Fix: [#18354] Overwrite alert does not show when save name has different casing on Windows. - Fix: [#18379] Tunnel entrances for underground Mini Golf Hole E are not rendered correctly. 0.4.2 (2022-10-05) diff --git a/src/openrct2-ui/windows/LoadSave.cpp b/src/openrct2-ui/windows/LoadSave.cpp index 2d0367dce6..f319595bc7 100644 --- a/src/openrct2-ui/windows/LoadSave.cpp +++ b/src/openrct2-ui/windows/LoadSave.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -570,8 +571,6 @@ static void WindowLoadsaveScrollmouseover(rct_window* w, int32_t scrollIndex, co static void WindowLoadsaveTextinput(rct_window* w, WidgetIndex widgetIndex, char* text) { - bool overwrite; - if (text == nullptr || text[0] == 0) return; @@ -608,17 +607,7 @@ static void WindowLoadsaveTextinput(rct_window* w, WidgetIndex widgetIndex, char const u8string path = Path::WithExtension( Path::Combine(_directory, text), RemovePatternWildcard(_extensionPattern)); - overwrite = false; - for (auto& item : _listItems) - { - if (String::Equals(item.path, path)) - { - overwrite = true; - break; - } - } - - if (overwrite) + if (File::Exists(path)) WindowOverwritePromptOpen(text, path.c_str()); else WindowLoadsaveSelect(w, path.c_str());