Revert "[VFS] Fixed crash on filename extraction from path."
This reverts commit02f5316562
. It's not needed anymore thanks to6cba5ba7e6
This commit is contained in:
parent
35cc2ccd7a
commit
d393725353
|
@ -112,7 +112,7 @@ bool DiscImageDevice::VerifyMagic(ParseState* state, size_t offset) {
|
|||
|
||||
DiscImageDevice::Error DiscImageDevice::ReadAllEntries(
|
||||
ParseState* state, const uint8_t* root_buffer) {
|
||||
auto root_entry = new DiscImageEntry(this, nullptr, "", "", mmap_.get());
|
||||
auto root_entry = new DiscImageEntry(this, nullptr, "", mmap_.get());
|
||||
root_entry->attributes_ = kFileAttributeDirectory;
|
||||
root_entry_ = std::unique_ptr<Entry>(root_entry);
|
||||
|
||||
|
|
|
@ -18,9 +18,8 @@ namespace xe {
|
|||
namespace vfs {
|
||||
|
||||
DiscImageEntry::DiscImageEntry(Device* device, Entry* parent,
|
||||
const std::string_view path,
|
||||
const std::string_view name, MappedMemory* mmap)
|
||||
: Entry(device, parent, path, name),
|
||||
const std::string_view path, MappedMemory* mmap)
|
||||
: Entry(device, parent, path),
|
||||
mmap_(mmap),
|
||||
data_offset_(0),
|
||||
data_size_(0) {}
|
||||
|
@ -31,8 +30,7 @@ std::unique_ptr<DiscImageEntry> DiscImageEntry::Create(
|
|||
Device* device, Entry* parent, const std::string_view name,
|
||||
MappedMemory* mmap) {
|
||||
auto path = xe::utf8::join_guest_paths(parent->path(), name);
|
||||
auto entry =
|
||||
std::make_unique<DiscImageEntry>(device, parent, path, name, mmap);
|
||||
auto entry = std::make_unique<DiscImageEntry>(device, parent, path, mmap);
|
||||
return std::move(entry);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ class DiscImageDevice;
|
|||
class DiscImageEntry : public Entry {
|
||||
public:
|
||||
DiscImageEntry(Device* device, Entry* parent, const std::string_view path,
|
||||
const std::string_view name, MappedMemory* mmap);
|
||||
MappedMemory* mmap);
|
||||
~DiscImageEntry() override;
|
||||
|
||||
static std::unique_ptr<DiscImageEntry> Create(Device* device, Entry* parent,
|
||||
|
|
|
@ -36,7 +36,7 @@ bool DiscZarchiveDevice::Initialize() {
|
|||
|
||||
const std::string root_path = std::string("/");
|
||||
const ZArchiveNodeHandle handle = reader_->LookUp(root_path);
|
||||
auto root_entry = new DiscZarchiveEntry(this, nullptr, root_path, "");
|
||||
auto root_entry = new DiscZarchiveEntry(this, nullptr, root_path);
|
||||
root_entry->attributes_ = kFileAttributeDirectory;
|
||||
root_entry->handle_ = static_cast<uint32_t>(handle);
|
||||
root_entry->name_ = root_path;
|
||||
|
@ -79,8 +79,7 @@ bool DiscZarchiveDevice::ReadAllEntries(const std::string& path,
|
|||
}
|
||||
|
||||
if (reader_->IsFile(handle)) {
|
||||
auto entry = new DiscZarchiveEntry(
|
||||
this, parent, path, xe::utf8::find_name_from_guest_path(path));
|
||||
auto entry = new DiscZarchiveEntry(this, parent, path);
|
||||
entry->attributes_ = kFileAttributeReadOnly;
|
||||
entry->handle_ = static_cast<uint32_t>(handle);
|
||||
entry->parent_ = parent;
|
||||
|
@ -104,8 +103,7 @@ bool DiscZarchiveDevice::ReadAllEntries(const std::string& path,
|
|||
return false;
|
||||
}
|
||||
|
||||
auto entry =
|
||||
new DiscZarchiveEntry(this, parent, full_path, dirEntry.name);
|
||||
auto entry = new DiscZarchiveEntry(this, parent, full_path);
|
||||
entry->handle_ = static_cast<uint32_t>(fileHandle);
|
||||
entry->data_offset_ = 0;
|
||||
|
||||
|
|
|
@ -20,9 +20,8 @@ namespace xe {
|
|||
namespace vfs {
|
||||
|
||||
DiscZarchiveEntry::DiscZarchiveEntry(Device* device, Entry* parent,
|
||||
const std::string_view path,
|
||||
const std::string_view name)
|
||||
: Entry(device, parent, path, name),
|
||||
const std::string_view path)
|
||||
: Entry(device, parent, path),
|
||||
data_offset_(0),
|
||||
data_size_(0),
|
||||
handle_(ZARCHIVE_INVALID_NODE) {}
|
||||
|
@ -32,7 +31,7 @@ DiscZarchiveEntry::~DiscZarchiveEntry() = default;
|
|||
std::unique_ptr<DiscZarchiveEntry> DiscZarchiveEntry::Create(
|
||||
Device* device, Entry* parent, const std::string_view name) {
|
||||
auto path = name; // xe::utf8::join_guest_paths(parent->path(), name);
|
||||
auto entry = std::make_unique<DiscZarchiveEntry>(device, parent, path, name);
|
||||
auto entry = std::make_unique<DiscZarchiveEntry>(device, parent, path);
|
||||
return std::move(entry);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,8 +23,7 @@ class DiscZarchiveDevice;
|
|||
|
||||
class DiscZarchiveEntry : public Entry {
|
||||
public:
|
||||
DiscZarchiveEntry(Device* device, Entry* parent, const std::string_view path,
|
||||
const std::string_view name);
|
||||
DiscZarchiveEntry(Device* device, Entry* parent, const std::string_view path);
|
||||
~DiscZarchiveEntry() override;
|
||||
|
||||
static std::unique_ptr<DiscZarchiveEntry> Create(Device* device,
|
||||
|
|
|
@ -39,7 +39,7 @@ bool HostPathDevice::Initialize() {
|
|||
}
|
||||
}
|
||||
|
||||
auto root_entry = new HostPathEntry(this, nullptr, "", "", host_path_);
|
||||
auto root_entry = new HostPathEntry(this, nullptr, "", host_path_);
|
||||
root_entry->attributes_ = kFileAttributeDirectory;
|
||||
root_entry_ = std::unique_ptr<Entry>(root_entry);
|
||||
PopulateEntry(root_entry);
|
||||
|
|
|
@ -23,9 +23,8 @@ namespace vfs {
|
|||
|
||||
HostPathEntry::HostPathEntry(Device* device, Entry* parent,
|
||||
const std::string_view path,
|
||||
const std::string_view name,
|
||||
const std::filesystem::path& host_path)
|
||||
: Entry(device, parent, path, name), host_path_(host_path) {}
|
||||
: Entry(device, parent, path), host_path_(host_path) {}
|
||||
|
||||
HostPathEntry::~HostPathEntry() = default;
|
||||
|
||||
|
@ -34,8 +33,7 @@ HostPathEntry* HostPathEntry::Create(Device* device, Entry* parent,
|
|||
xe::filesystem::FileInfo file_info) {
|
||||
auto path = xe::utf8::join_guest_paths(parent->path(),
|
||||
xe::path_to_utf8(file_info.name));
|
||||
auto entry = new HostPathEntry(device, parent, path,
|
||||
xe::path_to_utf8(file_info.name), full_path);
|
||||
auto entry = new HostPathEntry(device, parent, path, full_path);
|
||||
|
||||
entry->create_timestamp_ = file_info.create_timestamp;
|
||||
entry->access_timestamp_ = file_info.access_timestamp;
|
||||
|
|
|
@ -23,7 +23,6 @@ class HostPathDevice;
|
|||
class HostPathEntry : public Entry {
|
||||
public:
|
||||
HostPathEntry(Device* device, Entry* parent, const std::string_view path,
|
||||
const std::string_view name,
|
||||
const std::filesystem::path& host_path);
|
||||
~HostPathEntry() override;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ NullDevice::NullDevice(const std::string& mount_path,
|
|||
NullDevice::~NullDevice() = default;
|
||||
|
||||
bool NullDevice::Initialize() {
|
||||
auto root_entry = new NullEntry(this, nullptr, mount_path_, "");
|
||||
auto root_entry = new NullEntry(this, nullptr, mount_path_);
|
||||
root_entry->attributes_ = kFileAttributeDirectory;
|
||||
root_entry_ = std::unique_ptr<Entry>(root_entry);
|
||||
|
||||
|
|
|
@ -20,15 +20,14 @@
|
|||
namespace xe {
|
||||
namespace vfs {
|
||||
|
||||
NullEntry::NullEntry(Device* device, Entry* parent, std::string path,
|
||||
const std::string_view name)
|
||||
: Entry(device, parent, path, name) {}
|
||||
NullEntry::NullEntry(Device* device, Entry* parent, std::string path)
|
||||
: Entry(device, parent, path) {}
|
||||
|
||||
NullEntry::~NullEntry() = default;
|
||||
|
||||
NullEntry* NullEntry::Create(Device* device, Entry* parent,
|
||||
const std::string& path) {
|
||||
auto entry = new NullEntry(device, parent, path, "");
|
||||
auto entry = new NullEntry(device, parent, path);
|
||||
|
||||
entry->create_timestamp_ = 0;
|
||||
entry->access_timestamp_ = 0;
|
||||
|
|
|
@ -22,8 +22,7 @@ class NullDevice;
|
|||
|
||||
class NullEntry : public Entry {
|
||||
public:
|
||||
NullEntry(Device* device, Entry* parent, std::string path,
|
||||
const std::string_view name);
|
||||
NullEntry(Device* device, Entry* parent, std::string path);
|
||||
~NullEntry() override;
|
||||
|
||||
static NullEntry* Create(Device* device, Entry* parent,
|
||||
|
|
|
@ -17,9 +17,8 @@ namespace vfs {
|
|||
|
||||
XContentContainerEntry::XContentContainerEntry(Device* device, Entry* parent,
|
||||
const std::string_view path,
|
||||
const std::string_view name,
|
||||
MultiFileHandles* files)
|
||||
: Entry(device, parent, path, name),
|
||||
: Entry(device, parent, path),
|
||||
files_(files),
|
||||
data_offset_(0),
|
||||
data_size_(0),
|
||||
|
@ -31,8 +30,8 @@ std::unique_ptr<XContentContainerEntry> XContentContainerEntry::Create(
|
|||
Device* device, Entry* parent, const std::string_view name,
|
||||
MultiFileHandles* files) {
|
||||
auto path = xe::utf8::join_guest_paths(parent->path(), name);
|
||||
auto entry = std::make_unique<XContentContainerEntry>(device, parent, path,
|
||||
name, files);
|
||||
auto entry =
|
||||
std::make_unique<XContentContainerEntry>(device, parent, path, files);
|
||||
|
||||
return std::move(entry);
|
||||
}
|
||||
|
|
|
@ -26,8 +26,7 @@ class XContentContainerDevice;
|
|||
class XContentContainerEntry : public Entry {
|
||||
public:
|
||||
XContentContainerEntry(Device* device, Entry* parent,
|
||||
const std::string_view path,
|
||||
const std::string_view name, MultiFileHandles* files);
|
||||
const std::string_view path, MultiFileHandles* files);
|
||||
~XContentContainerEntry() override;
|
||||
|
||||
static std::unique_ptr<XContentContainerEntry> Create(
|
||||
|
|
|
@ -53,7 +53,7 @@ XContentContainerDevice::Result StfsContainerDevice::LoadHostFiles(
|
|||
StfsContainerDevice::Result StfsContainerDevice::Read() {
|
||||
auto& file = files_.at(0);
|
||||
|
||||
auto root_entry = new XContentContainerEntry(this, nullptr, "", "", &files_);
|
||||
auto root_entry = new XContentContainerEntry(this, nullptr, "", &files_);
|
||||
root_entry->attributes_ = kFileAttributeDirectory;
|
||||
root_entry_ = std::unique_ptr<Entry>(root_entry);
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ XContentContainerDevice::Result SvodContainerDevice::Read() {
|
|||
const uint64_t root_creation_timestamp =
|
||||
decode_fat_timestamp(root_data.creation_date, root_data.creation_time);
|
||||
|
||||
auto root_entry = new XContentContainerEntry(this, nullptr, "", "", &files_);
|
||||
auto root_entry = new XContentContainerEntry(this, nullptr, "", &files_);
|
||||
root_entry->attributes_ = kFileAttributeDirectory;
|
||||
root_entry->access_timestamp_ = root_creation_timestamp;
|
||||
root_entry->create_timestamp_ = root_creation_timestamp;
|
||||
|
|
|
@ -16,12 +16,10 @@
|
|||
namespace xe {
|
||||
namespace vfs {
|
||||
|
||||
Entry::Entry(Device* device, Entry* parent, const std::string_view path,
|
||||
const std::string_view name)
|
||||
Entry::Entry(Device* device, Entry* parent, const std::string_view path)
|
||||
: device_(device),
|
||||
parent_(parent),
|
||||
path_(path),
|
||||
name_(name),
|
||||
attributes_(0),
|
||||
size_(0),
|
||||
allocation_size_(0),
|
||||
|
@ -31,6 +29,7 @@ Entry::Entry(Device* device, Entry* parent, const std::string_view path,
|
|||
delete_on_close_(false) {
|
||||
assert_not_null(device);
|
||||
absolute_path_ = xe::utf8::join_guest_paths(device->mount_path(), path);
|
||||
name_ = xe::utf8::find_name_from_guest_path(path);
|
||||
}
|
||||
|
||||
Entry::~Entry() = default;
|
||||
|
|
|
@ -134,8 +134,7 @@ class Entry {
|
|||
virtual void update() { return; }
|
||||
|
||||
protected:
|
||||
Entry(Device* device, Entry* parent, const std::string_view path,
|
||||
const std::string_view name);
|
||||
Entry(Device* device, Entry* parent, const std::string_view path);
|
||||
|
||||
virtual std::unique_ptr<Entry> CreateEntryInternal(
|
||||
const std::string_view name, uint32_t attributes) {
|
||||
|
|
Loading…
Reference in New Issue