update_manager: add some logging

This commit is contained in:
Megamouse 2022-02-22 06:32:38 +01:00
parent 10e6b43a2f
commit fa6736e69d

View File

@ -597,11 +597,15 @@ bool update_manager::handle_rpcs3(const QByteArray& data, bool auto_accept)
// Move the appimage/exe and replace with new appimage
const std::string move_dest = replace_path + "_old";
fs::rename(replace_path, move_dest, true);
if (!fs::rename(replace_path, move_dest, true))
{
// Simply log error for now
update_log.error("Failed to move old AppImage file: %s (%s)", replace_path, fs::g_tls_error);
}
fs::file new_appimage(replace_path, fs::read + fs::write + fs::create + fs::trunc);
if (!new_appimage)
{
update_log.error("Failed to create new AppImage file: %s", replace_path);
update_log.error("Failed to create new AppImage file: %s (%s)", replace_path, fs::g_tls_error);
return false;
}
if (new_appimage.write(data.data(), data.size()) != data.size() + 0u)
@ -611,7 +615,7 @@ bool update_manager::handle_rpcs3(const QByteArray& data, bool auto_accept)
}
if (fchmod(new_appimage.get_handle(), S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) == -1)
{
update_log.error("Failed to chmod rwxrxrx %s", replace_path);
update_log.error("Failed to chmod rwxrxrx %s (%s)", replace_path, strerror(errno));
return false;
}
new_appimage.close();