提交 65d45304 编写于 作者: J jp9000

UI/updater: Fix temp files being created and not deleted

The GetTempPath and GetTempFileName functions weren't being used
correctly, GetTempFileName always create a temporary file, and was
creating a temporary file in the root directory of the hard drive
unintentionally.
上级 bc9a5817
......@@ -987,18 +987,18 @@ static bool Update(wchar_t *cmdLine)
StringCbPrintf(manifestPath, sizeof(manifestPath),
L"%s\\updates\\manifest.json", lpAppDataPath);
if (!GetTempPathW(_countof(tempPath), tempPath)) {
if (!GetTempPathW(_countof(tempDirName), tempDirName)) {
Status(L"Update failed: Failed to get temp path: %ld",
GetLastError());
return false;
}
if (!GetTempFileNameW(tempDirName, L"obs-studio", 0, tempDirName)) {
if (!GetTempFileNameW(tempDirName, L"obs-studio", 0, tempPath)) {
Status(L"Update failed: Failed to create temp dir name: %ld",
GetLastError());
return false;
}
StringCbCat(tempPath, sizeof(tempPath), tempDirName);
DeleteFile(tempPath);
CreateDirectory(tempPath, nullptr);
/* ------------------------------------- *
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册