absolute_path for XFile and Entry.
This commit is contained in:
parent
b62134855a
commit
7da2ad30b0
|
@ -28,12 +28,16 @@ DiscImageFile::DiscImageFile(
|
|||
DiscImageFile::~DiscImageFile() {
|
||||
}
|
||||
|
||||
const char* DiscImageFile::name(void) {
|
||||
return entry_->name();
|
||||
const char* DiscImageFile::path(void) const {
|
||||
return entry_->path();
|
||||
}
|
||||
|
||||
const char* DiscImageFile::path(void) {
|
||||
return entry_->path();
|
||||
const char* DiscImageFile::absolute_path(void) const {
|
||||
return entry_->absolute_path();
|
||||
}
|
||||
|
||||
const char* DiscImageFile::name(void) const {
|
||||
return entry_->name();
|
||||
}
|
||||
|
||||
X_STATUS DiscImageFile::QueryInfo(XFileInfo* out_info) {
|
||||
|
|
|
@ -29,8 +29,9 @@ public:
|
|||
DiscImageEntry* entry);
|
||||
virtual ~DiscImageFile();
|
||||
|
||||
virtual const char* name(void);
|
||||
virtual const char* path(void);
|
||||
virtual const char* path(void) const;
|
||||
virtual const char* absolute_path(void) const;
|
||||
virtual const char* name(void) const;
|
||||
|
||||
virtual X_STATUS QueryInfo(XFileInfo* out_info);
|
||||
virtual X_STATUS QueryDirectory(XDirectoryInfo* out_info,
|
||||
|
|
|
@ -28,12 +28,16 @@ HostPathFile::~HostPathFile() {
|
|||
CloseHandle(file_handle_);
|
||||
}
|
||||
|
||||
const char* HostPathFile::name(void) {
|
||||
return entry_->name();
|
||||
const char* HostPathFile::path(void) const {
|
||||
return entry_->path();
|
||||
}
|
||||
|
||||
const char* HostPathFile::path(void) {
|
||||
return entry_->path();
|
||||
const char* HostPathFile::absolute_path(void) const {
|
||||
return entry_->absolute_path();
|
||||
}
|
||||
|
||||
const char* HostPathFile::name(void) const {
|
||||
return entry_->name();
|
||||
}
|
||||
|
||||
X_STATUS HostPathFile::QueryInfo(XFileInfo* out_info) {
|
||||
|
|
|
@ -29,8 +29,9 @@ public:
|
|||
HostPathEntry* entry, HANDLE file_handle);
|
||||
virtual ~HostPathFile();
|
||||
|
||||
virtual const char* name(void);
|
||||
virtual const char* path(void);
|
||||
virtual const char* path(void) const;
|
||||
virtual const char* absolute_path(void) const;
|
||||
virtual const char* name(void) const;
|
||||
|
||||
virtual X_STATUS QueryInfo(XFileInfo* out_info);
|
||||
virtual X_STATUS QueryDirectory(XDirectoryInfo* out_info,
|
||||
|
|
|
@ -28,12 +28,16 @@ STFSContainerFile::STFSContainerFile(
|
|||
STFSContainerFile::~STFSContainerFile() {
|
||||
}
|
||||
|
||||
const char* STFSContainerFile::name(void) {
|
||||
return entry_->name();
|
||||
const char* STFSContainerFile::path(void) const {
|
||||
return entry_->path();
|
||||
}
|
||||
|
||||
const char* STFSContainerFile::path(void) {
|
||||
return entry_->path();
|
||||
const char* STFSContainerFile::absolute_path(void) const {
|
||||
return entry_->absolute_path();
|
||||
}
|
||||
|
||||
const char* STFSContainerFile::name(void) const {
|
||||
return entry_->name();
|
||||
}
|
||||
|
||||
X_STATUS STFSContainerFile::QueryInfo(XFileInfo* out_info) {
|
||||
|
|
|
@ -29,8 +29,9 @@ public:
|
|||
STFSContainerEntry* entry);
|
||||
virtual ~STFSContainerFile();
|
||||
|
||||
virtual const char* name(void);
|
||||
virtual const char* path(void);
|
||||
virtual const char* path(void) const;
|
||||
virtual const char* absolute_path(void) const;
|
||||
virtual const char* name(void) const;
|
||||
|
||||
virtual X_STATUS QueryInfo(XFileInfo* out_info);
|
||||
virtual X_STATUS QueryDirectory(XDirectoryInfo* out_info,
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*/
|
||||
|
||||
#include <xenia/kernel/fs/entry.h>
|
||||
|
||||
#include <xenia/kernel/fs/device.h>
|
||||
|
||||
using namespace xe;
|
||||
using namespace xe::kernel;
|
||||
|
@ -26,12 +26,16 @@ MemoryMapping::~MemoryMapping() {
|
|||
Entry::Entry(Type type, Device* device, const char* path) :
|
||||
type_(type),
|
||||
device_(device) {
|
||||
XEASSERTNOTNULL(device);
|
||||
path_ = xestrdupa(path);
|
||||
// TODO(benvanik): *shudder*
|
||||
absolute_path_ = xestrdupa((std::string(device->path()) + std::string(path)).c_str());
|
||||
// TODO(benvanik): last index of \, unless \ at end, then before that
|
||||
name_ = NULL;
|
||||
}
|
||||
|
||||
Entry::~Entry() {
|
||||
xe_free(path_);
|
||||
xe_free(name_);
|
||||
xe_free(path_);
|
||||
xe_free(absolute_path_);
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@ public:
|
|||
Type type() const { return type_; }
|
||||
Device* device() const { return device_; }
|
||||
const char* path() const { return path_; }
|
||||
const char* absolute_path() const { return absolute_path_; }
|
||||
const char* name() const { return name_; }
|
||||
|
||||
virtual X_STATUS QueryInfo(XFileInfo* out_info) = 0;
|
||||
|
@ -76,6 +77,7 @@ private:
|
|||
Type type_;
|
||||
Device* device_;
|
||||
char* path_;
|
||||
char* absolute_path_;
|
||||
char* name_;
|
||||
};
|
||||
|
||||
|
|
|
@ -87,8 +87,9 @@ class XFile : public XObject {
|
|||
public:
|
||||
virtual ~XFile();
|
||||
|
||||
virtual const char* name(void) = 0;
|
||||
virtual const char* path(void) = 0;
|
||||
virtual const char* path(void) const = 0;
|
||||
virtual const char* absolute_path(void) const = 0;
|
||||
virtual const char* name(void) const = 0;
|
||||
|
||||
size_t position() const { return position_; }
|
||||
void set_position(size_t value) { position_ = value; }
|
||||
|
|
Loading…
Reference in New Issue