summaryrefslogtreecommitdiff
path: root/Source/Core/WinUpdater/Main.cpp
diff options
context:
space:
mode:
authorAdmiral H. Curtiss <pikachu025@gmail.com>2022-11-22 01:36:04 +0100
committerAdmiral H. Curtiss <pikachu025@gmail.com>2022-11-22 02:38:42 +0100
commit5ebb894685a97570c3d12eb00956c32d56557629 (patch)
tree896b45d14576ad551781a929d16ffa71f24912e3 /Source/Core/WinUpdater/Main.cpp
parentf0fb8c22b0383d65570cbb13a270cf33137dc530 (diff)
Updater: Delete the file we check for write rights with on Windows.
Diffstat (limited to 'Source/Core/WinUpdater/Main.cpp')
-rw-r--r--Source/Core/WinUpdater/Main.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/Source/Core/WinUpdater/Main.cpp b/Source/Core/WinUpdater/Main.cpp
index 85b29e8226..6b7fd801ef 100644
--- a/Source/Core/WinUpdater/Main.cpp
+++ b/Source/Core/WinUpdater/Main.cpp
@@ -38,13 +38,15 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine
return 1;
}
- FILE* test_fh =
- _wfopen((std::filesystem::path(*path).parent_path() / "Updater.log").c_str(), L"w");
+ const auto test_fh = ::CreateFileW(
+ (std::filesystem::path(*path).parent_path() / "directory_writable_check.tmp").c_str(),
+ GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS,
+ FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_DELETE_ON_CLOSE, nullptr);
- if (test_fh == nullptr)
+ if (test_fh == INVALID_HANDLE_VALUE)
need_admin = true;
else
- fclose(test_fh);
+ CloseHandle(test_fh);
if (need_admin)
{