From bb34e9f501ba4f9c16b9e7731badcf2d58c7d646 Mon Sep 17 00:00:00 2001 From: Cooliokid956 <68075390+Cooliokid956@users.noreply.github.com> Date: Sun, 19 May 2024 21:42:06 -0500 Subject: [PATCH] quick patch: don't rename tmp folder if .tmp already exists (#48) if ex-coop is ran after the tmp folder is renamed, a new tmp folder will be created, which coopdx will then attempt to rename on the next run and fail to do so since .tmp already exists, resulting in the game failing to open --- src/pc/rom_checker.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pc/rom_checker.cpp b/src/pc/rom_checker.cpp index 07998f741..6d85e1b96 100644 --- a/src/pc/rom_checker.cpp +++ b/src/pc/rom_checker.cpp @@ -38,11 +38,12 @@ static struct VanillaMD5 sVanillaMD5[] = { inline static void rename_tmp_folder() { std::string userPath = fs_get_write_path(""); std::string oldPath = userPath + "tmp"; - if (fs::exists(oldPath)) { + std::string newPath = userPath + TMP_DIRECTORY; + if (fs::exists(oldPath) && !fs::exists(newPath)) { #if defined(_WIN32) || defined(_WIN64) SetFileAttributesA(oldPath.c_str(), FILE_ATTRIBUTE_HIDDEN); #endif - fs::rename(oldPath, userPath + TMP_DIRECTORY); + fs::rename(oldPath, newPath); } }