Updater: Delete the file we check for write rights with on Windows.

This commit is contained in:
Admiral H. Curtiss 2022-11-22 01:36:04 +01:00
parent f0fb8c22b0
commit 5ebb894685
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
1 changed files with 6 additions and 4 deletions

View File

@ -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)
{