summaryrefslogtreecommitdiffstats
path: root/src/core/file_sys/archive.h
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2014-11-18 04:26:54 +0100
committerbunnei <bunneidev@gmail.com>2014-11-18 04:26:54 +0100
commitb66859714bda5968e36fed47a2ff8516bcfd2248 (patch)
treef1a933079afdfea73e76a187441733642489e2b0 /src/core/file_sys/archive.h
parentMerge pull request #201 from archshift/boss (diff)
parentArchive: Fixed to not destroy archive handle on close. (diff)
downloadyuzu-b66859714bda5968e36fed47a2ff8516bcfd2248.tar
yuzu-b66859714bda5968e36fed47a2ff8516bcfd2248.tar.gz
yuzu-b66859714bda5968e36fed47a2ff8516bcfd2248.tar.bz2
yuzu-b66859714bda5968e36fed47a2ff8516bcfd2248.tar.lz
yuzu-b66859714bda5968e36fed47a2ff8516bcfd2248.tar.xz
yuzu-b66859714bda5968e36fed47a2ff8516bcfd2248.tar.zst
yuzu-b66859714bda5968e36fed47a2ff8516bcfd2248.zip
Diffstat (limited to 'src/core/file_sys/archive.h')
-rw-r--r--src/core/file_sys/archive.h35
1 files changed, 32 insertions, 3 deletions
diff --git a/src/core/file_sys/archive.h b/src/core/file_sys/archive.h
index 38145eed8..dc2d2ced9 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:
@@ -153,21 +182,21 @@ public:
* @param mode Mode to open the file with
* @return Opened file, or nullptr
*/
- virtual std::unique_ptr<File> OpenFile(const std::string& path, const Mode mode) const = 0;
+ virtual std::unique_ptr<File> 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<Directory> OpenDirectory(const std::string& path) const = 0;
+ virtual std::unique_ptr<Directory> OpenDirectory(const Path& path) const = 0;
/**
* Read data from the archive