Read STFS headers for unpackaged files from [path].headers
This commit is contained in:
parent
3423198de3
commit
aca251d382
|
@ -133,14 +133,25 @@ std::vector<XCONTENT_DATA> ContentManager::ListContent(uint32_t device_id,
|
||||||
content_data.display_name = xe::path_to_utf16(file_info.name);
|
content_data.display_name = xe::path_to_utf16(file_info.name);
|
||||||
content_data.file_name = xe::path_to_utf8(file_info.name);
|
content_data.file_name = xe::path_to_utf8(file_info.name);
|
||||||
|
|
||||||
if (file_info.type != xe::filesystem::FileInfo::Type::kDirectory) {
|
auto headers_path = file_info.path / file_info.name;
|
||||||
// Not a directory so must be a package, verify size to make sure
|
if (file_info.type == xe::filesystem::FileInfo::Type::kDirectory) {
|
||||||
if (file_info.total_size <= vfs::StfsHeader::kHeaderLength) {
|
headers_path = headers_path / L".headers";
|
||||||
continue; // Invalid package (maybe .headers file)
|
}
|
||||||
|
|
||||||
|
filesystem::FileInfo entry;
|
||||||
|
bool doesEntryExist = filesystem::GetInfo(headers_path, &entry);
|
||||||
|
|
||||||
|
if (doesEntryExist) {
|
||||||
|
// File is either package or directory that has .headers file
|
||||||
|
|
||||||
|
if (file_info.type != xe::filesystem::FileInfo::Type::kDirectory) {
|
||||||
|
// Not a directory so must be a package, verify size to make sure
|
||||||
|
if (file_info.total_size <= vfs::StfsHeader::kHeaderLength) {
|
||||||
|
continue; // Invalid package (maybe .headers file)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto map = MappedMemory::Open(file_info.path / file_info.name,
|
auto map = MappedMemory::Open(headers_path, MappedMemory::Mode::kRead, 0,
|
||||||
MappedMemory::Mode::kRead, 0,
|
|
||||||
vfs::StfsHeader::kHeaderLength);
|
vfs::StfsHeader::kHeaderLength);
|
||||||
if (map) {
|
if (map) {
|
||||||
vfs::StfsHeader header;
|
vfs::StfsHeader header;
|
||||||
|
|
Loading…
Reference in New Issue