From c04a04189ad9902e95d6dce5c6bb712cc8342f56 Mon Sep 17 00:00:00 2001 From: bunnei Date: Thu, 13 Nov 2014 19:26:33 -0500 Subject: FileSys: Added DebugStr method to Path class. --- src/core/file_sys/archive.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/core/file_sys/archive.h') diff --git a/src/core/file_sys/archive.h b/src/core/file_sys/archive.h index 38145eed8..7b3130f16 100644 --- a/src/core/file_sys/archive.h +++ b/src/core/file_sys/archive.h @@ -74,6 +74,35 @@ public: return type; } + /** + * Gets the string representation of the path for debugging + * @return String representation of the path for debugging + */ + const std::string DebugStr() const { + switch (GetType()) { + case Invalid: + return "[Invalid]"; + case Empty: + return "[Empty]"; + case Binary: + { + std::stringstream res; + res << "[Binary: "; + for (unsigned byte : binary) + res << std::hex << std::setw(2) << std::setfill('0') << byte; + res << ']'; + return res.str(); + } + case Char: + return "[Char: " + AsString() + ']'; + case Wchar: + return "[Wchar: " + AsString() + ']'; + default: + ERROR_LOG(KERNEL, "LowPathType cannot be converted to string!"); + return {}; + } + } + const std::string AsString() const { switch (GetType()) { case Char: -- cgit v1.2.3 From a3107a6b571dedb8828b20ddcb709ec17db9715a Mon Sep 17 00:00:00 2001 From: bunnei Date: Tue, 11 Nov 2014 19:27:35 -0500 Subject: FileSys: Updated backend code to use FileSys::Path instead of string for paths. --- src/core/file_sys/archive.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/core/file_sys/archive.h') diff --git a/src/core/file_sys/archive.h b/src/core/file_sys/archive.h index 7b3130f16..dc2d2ced9 100644 --- a/src/core/file_sys/archive.h +++ b/src/core/file_sys/archive.h @@ -182,21 +182,21 @@ public: * @param mode Mode to open the file with * @return Opened file, or nullptr */ - virtual std::unique_ptr OpenFile(const std::string& path, const Mode mode) const = 0; + virtual std::unique_ptr OpenFile(const Path& path, const Mode mode) const = 0; /** * Create a directory specified by its path * @param path Path relative to the archive * @return Whether the directory could be created */ - virtual bool CreateDirectory(const std::string& path) const = 0; + virtual bool CreateDirectory(const Path& path) const = 0; /** * Open a directory specified by its path * @param path Path relative to the archive * @return Opened directory, or nullptr */ - virtual std::unique_ptr OpenDirectory(const std::string& path) const = 0; + virtual std::unique_ptr OpenDirectory(const Path& path) const = 0; /** * Read data from the archive -- cgit v1.2.3