filter out some apps (hbmenu, retroarch core) if replaced via another app, or false positive. remove uneeded file.close() and commit calls.
This commit is contained in:
@@ -260,7 +260,6 @@ Result read_entire_file(FsFileSystem* _fs, const FsPath& path, std::vector<u8>&
|
||||
|
||||
File f;
|
||||
R_TRY(fs.OpenFile(path, FsOpenMode_Read, &f));
|
||||
ON_SCOPE_EXIT(f.Close());
|
||||
|
||||
s64 size;
|
||||
R_TRY(f.GetSize(&size));
|
||||
@@ -278,7 +277,6 @@ Result write_entire_file(FsFileSystem* _fs, const FsPath& path, const std::vecto
|
||||
|
||||
FsNative fs{_fs, false, ignore_read_only};
|
||||
R_TRY(fs.GetFsOpenResult());
|
||||
ON_SCOPE_EXIT(fs.Commit());
|
||||
|
||||
if (auto rc = fs.CreateFile(path, in.size(), 0); R_FAILED(rc) && rc != FsError_PathAlreadyExists) {
|
||||
return rc;
|
||||
@@ -286,8 +284,6 @@ Result write_entire_file(FsFileSystem* _fs, const FsPath& path, const std::vecto
|
||||
|
||||
File f;
|
||||
R_TRY(fs.OpenFile(path, FsOpenMode_Write, &f));
|
||||
ON_SCOPE_EXIT(f.Close());
|
||||
|
||||
R_TRY(f.SetSize(in.size()));
|
||||
R_TRY(f.Write(0, in.data(), in.size(), FsWriteOption_None));
|
||||
|
||||
@@ -824,8 +820,6 @@ Result FileGetSizeAndTimestamp(fs::Fs* m_fs, const FsPath& path, FsTimeStampRaw*
|
||||
|
||||
File f;
|
||||
R_TRY(m_fs->OpenFile(path, FsOpenMode_Read, &f));
|
||||
ON_SCOPE_EXIT(f.Close());
|
||||
|
||||
R_TRY(f.GetSize(size));
|
||||
} else {
|
||||
struct stat st;
|
||||
|
||||
@@ -1225,7 +1225,28 @@ void Menu::ScanHomebrew() {
|
||||
// if we get here, this means that we have the file, but not the .info file
|
||||
// report the file as locally installed to match hb-appstore.
|
||||
if (e.status == EntryStatus::Get) {
|
||||
// filter out some apps.
|
||||
bool filtered{};
|
||||
|
||||
// ignore hbmenu if it was replaced with sphaira.
|
||||
if (e.name == "hbmenu") {
|
||||
NacpStruct nacp;
|
||||
if (R_SUCCEEDED(nro_get_nacp(e.binary, nacp))) {
|
||||
filtered = std::strcmp(nacp.lang[0].name, "nx-hbmenu");
|
||||
}
|
||||
}
|
||||
// ignore single retroarch core.
|
||||
else if (e.name == "snes9x_2010") {
|
||||
filtered = true;
|
||||
}
|
||||
// todo: filter
|
||||
// - sys-clk
|
||||
|
||||
if (!filtered) {
|
||||
e.status = EntryStatus::Local;
|
||||
} else {
|
||||
log_write("filtered: %s path: %s\n", e.name.c_str(), e.binary.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user