mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-08-24 02:34:23 -05:00
updater: Treat mapped file errors as a sharing violation
For whatever reason there exists a different error code if the file has been opened as a mapped file, so we need to handle it.
This commit is contained in:
@@ -1068,8 +1068,10 @@ static bool UpdateFile(ZSTD_DCtx *ctx, update_t &file)
|
||||
L".old");
|
||||
|
||||
if (!MyCopyFile(file.outputPath.c_str(), oldFileRenamedPath)) {
|
||||
DWORD err = GetLastError();
|
||||
int is_sharing_violation =
|
||||
(GetLastError() == ERROR_SHARING_VIOLATION);
|
||||
(err == ERROR_SHARING_VIOLATION ||
|
||||
err == ERROR_USER_MAPPED_FILE);
|
||||
|
||||
if (is_sharing_violation)
|
||||
Status(L"Update failed: %s is still in use. "
|
||||
@@ -1128,7 +1130,8 @@ static bool UpdateFile(ZSTD_DCtx *ctx, update_t &file)
|
||||
|
||||
if (!installed_ok) {
|
||||
int is_sharing_violation =
|
||||
(error_code == ERROR_SHARING_VIOLATION);
|
||||
(error_code == ERROR_SHARING_VIOLATION ||
|
||||
error_code == ERROR_USER_MAPPED_FILE);
|
||||
|
||||
if (is_sharing_violation) {
|
||||
if (!already_tried_to_move) {
|
||||
|
||||
Reference in New Issue
Block a user