FileSys: Updated backend code to use FileSys::Path instead of string for paths.

This commit is contained in:
bunnei 2014-11-11 19:27:35 -05:00
parent c04a04189a
commit a3107a6b57
12 changed files with 38 additions and 38 deletions

View file

@ -129,12 +129,12 @@ public:
class File : public Object {
public:
std::string GetTypeName() const override { return "File"; }
std::string GetName() const override { return path; }
std::string GetName() const override { return path.DebugStr(); }
static Kernel::HandleType GetStaticHandleType() { return HandleType::File; }
Kernel::HandleType GetHandleType() const override { return HandleType::File; }
std::string path; ///< Path of the file
FileSys::Path path; ///< Path of the file
std::unique_ptr<FileSys::File> backend; ///< File backend interface
/**
@ -221,12 +221,12 @@ public:
class Directory : public Object {
public:
std::string GetTypeName() const override { return "Directory"; }
std::string GetName() const override { return path; }
std::string GetName() const override { return path.DebugStr(); }
static Kernel::HandleType GetStaticHandleType() { return HandleType::Directory; }
Kernel::HandleType GetHandleType() const override { return HandleType::Directory; }
std::string path; ///< Path of the directory
FileSys::Path path; ///< Path of the directory
std::unique_ptr<FileSys::Directory> backend; ///< File backend interface
/**
@ -366,7 +366,7 @@ Handle CreateArchive(FileSys::Archive* backend, const std::string& name) {
* @param mode Mode under which to open the File
* @return Opened File object
*/
Handle OpenFileFromArchive(Handle archive_handle, const std::string& path, const FileSys::Mode mode) {
Handle OpenFileFromArchive(Handle archive_handle, const FileSys::Path& path, const FileSys::Mode mode) {
File* file = new File;
Handle handle = Kernel::g_object_pool.Create(file);
@ -386,7 +386,7 @@ Handle OpenFileFromArchive(Handle archive_handle, const std::string& path, const
* @param path Path to the Directory inside of the Archive
* @return Opened Directory object
*/
Result CreateDirectoryFromArchive(Handle archive_handle, const std::string& path) {
Result CreateDirectoryFromArchive(Handle archive_handle, const FileSys::Path& path) {
Archive* archive = Kernel::g_object_pool.GetFast<Archive>(archive_handle);
if (archive == nullptr)
return -1;
@ -401,7 +401,7 @@ Result CreateDirectoryFromArchive(Handle archive_handle, const std::string& path
* @param path Path to the Directory inside of the Archive
* @return Opened Directory object
*/
Handle OpenDirectoryFromArchive(Handle archive_handle, const std::string& path) {
Handle OpenDirectoryFromArchive(Handle archive_handle, const FileSys::Path& path) {
Directory* directory = new Directory;
Handle handle = Kernel::g_object_pool.Create(directory);

View file

@ -43,7 +43,7 @@ Handle CreateArchive(FileSys::Archive* backend, const std::string& name);
* @param mode Mode under which to open the File
* @return Opened File object
*/
Handle OpenFileFromArchive(Handle archive_handle, const std::string& name, const FileSys::Mode mode);
Handle OpenFileFromArchive(Handle archive_handle, const FileSys::Path& path, const FileSys::Mode mode);
/**
* Create a Directory from an Archive
@ -51,7 +51,7 @@ Handle OpenFileFromArchive(Handle archive_handle, const std::string& name, const
* @param path Path to the Directory inside of the Archive
* @return Whether creation of directory succeeded
*/
Result CreateDirectoryFromArchive(Handle archive_handle, const std::string& name);
Result CreateDirectoryFromArchive(Handle archive_handle, const FileSys::Path& path);
/**
* Open a Directory from an Archive
@ -59,7 +59,7 @@ Result CreateDirectoryFromArchive(Handle archive_handle, const std::string& name
* @param path Path to the Directory inside of the Archive
* @return Opened Directory object
*/
Handle OpenDirectoryFromArchive(Handle archive_handle, const std::string& name);
Handle OpenDirectoryFromArchive(Handle archive_handle, const FileSys::Path& path);
/// Initialize archives
void ArchiveInit();

View file

@ -55,7 +55,7 @@ void OpenFile(Service::Interface* self) {
DEBUG_LOG(KERNEL, "type=%d size=%d mode=%d attrs=%d data=%s",
filename_type, filename_size, mode, attributes, file_string.c_str());
Handle handle = Kernel::OpenFileFromArchive(archive_handle, file_string, mode);
Handle handle = Kernel::OpenFileFromArchive(archive_handle, file_path, mode);
if (handle) {
cmd_buff[1] = 0;
cmd_buff[3] = handle;
@ -115,7 +115,7 @@ void OpenFileDirectly(Service::Interface* self) {
return;
}
Handle handle = Kernel::OpenFileFromArchive(archive_handle, file_string, mode);
Handle handle = Kernel::OpenFileFromArchive(archive_handle, file_path, mode);
if (handle) {
cmd_buff[1] = 0;
cmd_buff[3] = handle;
@ -163,7 +163,7 @@ void CreateDirectory(Service::Interface* self) {
DEBUG_LOG(KERNEL, "type=%d size=%d data=%s", dirname_type, dirname_size, dir_string.c_str());
cmd_buff[1] = Kernel::CreateDirectoryFromArchive(archive_handle, dir_string);
cmd_buff[1] = Kernel::CreateDirectoryFromArchive(archive_handle, dir_path);
DEBUG_LOG(KERNEL, "called");
}
@ -192,7 +192,7 @@ void OpenDirectory(Service::Interface* self) {
DEBUG_LOG(KERNEL, "type=%d size=%d data=%s", dirname_type, dirname_size, dir_string.c_str());
Handle handle = Kernel::OpenDirectoryFromArchive(archive_handle, dir_string);
Handle handle = Kernel::OpenDirectoryFromArchive(archive_handle, dir_path);
if (handle) {
cmd_buff[1] = 0;
cmd_buff[3] = handle;