mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-07 15:31:26 +12:00
Improve TAR loader
Don't overwrite unchanged files. Print error if failed to overwrite. This commit affects PS3 firmware installation. Trying to workaround a bug where some files cannot be overwritten.
This commit is contained in:
parent
17f3a114be
commit
5524cd1e75
1 changed files with 22 additions and 2 deletions
|
@ -114,9 +114,29 @@ bool tar_object::extract(std::string path, std::string ignore)
|
||||||
{
|
{
|
||||||
case '0':
|
case '0':
|
||||||
{
|
{
|
||||||
|
auto data = get_file(header.name).release();
|
||||||
|
|
||||||
|
if (fs::file prev{result})
|
||||||
|
{
|
||||||
|
if (prev.to_vector<u8>() == static_cast<fs::container_stream<std::vector<u8>>*>(data.get())->obj)
|
||||||
|
{
|
||||||
|
// Workaround: avoid overwriting existing data if it's the same.
|
||||||
|
tar_log.notice("TAR Loader: skipped existing file %s", header.name);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fs::file file(result, fs::rewrite);
|
fs::file file(result, fs::rewrite);
|
||||||
file.write(get_file(header.name).to_vector<u8>());
|
|
||||||
break;
|
if (file)
|
||||||
|
{
|
||||||
|
file.write(static_cast<fs::container_stream<std::vector<u8>>*>(data.get())->obj);
|
||||||
|
tar_log.notice("TAR Loader: written file %s", header.name);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
tar_log.error("TAR Loader: failed to write file %s (%s)", header.name, fs::g_tls_error);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
case '5':
|
case '5':
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue