mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-10 14:39:01 +01:00
MacUpdater: Fix permissions some more
This commit is contained in:
parent
19f4772e47
commit
0ebf3b90e3
@ -563,10 +563,17 @@ bool UpdateFiles(const std::vector<TodoList::UpdateOp>& to_update,
|
|||||||
|
|
||||||
// TODO: A new updater protocol version is required to properly mark executable files. For
|
// TODO: A new updater protocol version is required to properly mark executable files. For
|
||||||
// now, copy executable bits from existing files. This will break for newly added executables.
|
// now, copy executable bits from existing files. This will break for newly added executables.
|
||||||
mode_t permission;
|
std::optional<mode_t> permission;
|
||||||
|
|
||||||
if (File::Exists(path))
|
if (File::Exists(path))
|
||||||
{
|
{
|
||||||
|
struct stat file_stats;
|
||||||
|
|
||||||
|
if (stat(path.c_str(), &file_stats) != 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
permission = file_stats.st_mode;
|
||||||
|
|
||||||
std::string contents;
|
std::string contents;
|
||||||
if (!File::ReadFileToString(path, contents))
|
if (!File::ReadFileToString(path, contents))
|
||||||
{
|
{
|
||||||
@ -581,13 +588,6 @@ bool UpdateFiles(const std::vector<TodoList::UpdateOp>& to_update,
|
|||||||
}
|
}
|
||||||
else if (!op.old_hash || contents_hash != *op.old_hash)
|
else if (!op.old_hash || contents_hash != *op.old_hash)
|
||||||
{
|
{
|
||||||
struct stat file_stats;
|
|
||||||
|
|
||||||
if (stat(path.c_str(), &file_stats) != 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
permission = file_stats.st_mode;
|
|
||||||
|
|
||||||
if (!BackupFile(path))
|
if (!BackupFile(path))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -604,7 +604,7 @@ bool UpdateFiles(const std::vector<TodoList::UpdateOp>& to_update,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chmod(path.c_str(), permission) != 0)
|
if (permission.has_value() && chmod(path.c_str(), permission.value()) != 0)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user