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
This commit is contained in:
parent
f5db61f864
commit
bb34e9f501
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue