diff options
Diffstat (limited to 'src/core/file_sys/archive.h')
| -rw-r--r-- | src/core/file_sys/archive.h | 35 |
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: | |||
| 74 | return type; | 74 | return type; |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | /** | ||
| 78 | * Gets the string representation of the path for debugging | ||
| 79 | * @return String representation of the path for debugging | ||
| 80 | */ | ||
| 81 | const std::string DebugStr() const { | ||
| 82 | switch (GetType()) { | ||
| 83 | case Invalid: | ||
| 84 | return "[Invalid]"; | ||
| 85 | case Empty: | ||
| 86 | return "[Empty]"; | ||
| 87 | case Binary: | ||
| 88 | { | ||
| 89 | std::stringstream res; | ||
| 90 | res << "[Binary: "; | ||
| 91 | for (unsigned byte : binary) | ||
| 92 | res << std::hex << std::setw(2) << std::setfill('0') << byte; | ||
| 93 | res << ']'; | ||
| 94 | return res.str(); | ||
| 95 | } | ||
| 96 | case Char: | ||
| 97 | return "[Char: " + AsString() + ']'; | ||
| 98 | case Wchar: | ||
| 99 | return "[Wchar: " + AsString() + ']'; | ||
| 100 | default: | ||
| 101 | ERROR_LOG(KERNEL, "LowPathType cannot be converted to string!"); | ||
| 102 | return {}; | ||
| 103 | } | ||
| 104 | } | ||
| 105 | |||
| 77 | const std::string AsString() const { | 106 | const std::string AsString() const { |
| 78 | switch (GetType()) { | 107 | switch (GetType()) { |
| 79 | case Char: | 108 | case Char: |
| @@ -153,21 +182,21 @@ public: | |||
| 153 | * @param mode Mode to open the file with | 182 | * @param mode Mode to open the file with |
| 154 | * @return Opened file, or nullptr | 183 | * @return Opened file, or nullptr |
| 155 | */ | 184 | */ |
| 156 | virtual std::unique_ptr<File> OpenFile(const std::string& path, const Mode mode) const = 0; | 185 | virtual std::unique_ptr<File> OpenFile(const Path& path, const Mode mode) const = 0; |
| 157 | 186 | ||
| 158 | /** | 187 | /** |
| 159 | * Create a directory specified by its path | 188 | * Create a directory specified by its path |
| 160 | * @param path Path relative to the archive | 189 | * @param path Path relative to the archive |
| 161 | * @return Whether the directory could be created | 190 | * @return Whether the directory could be created |
| 162 | */ | 191 | */ |
| 163 | virtual bool CreateDirectory(const std::string& path) const = 0; | 192 | virtual bool CreateDirectory(const Path& path) const = 0; |
| 164 | 193 | ||
| 165 | /** | 194 | /** |
| 166 | * Open a directory specified by its path | 195 | * Open a directory specified by its path |
| 167 | * @param path Path relative to the archive | 196 | * @param path Path relative to the archive |
| 168 | * @return Opened directory, or nullptr | 197 | * @return Opened directory, or nullptr |
| 169 | */ | 198 | */ |
| 170 | virtual std::unique_ptr<Directory> OpenDirectory(const std::string& path) const = 0; | 199 | virtual std::unique_ptr<Directory> OpenDirectory(const Path& path) const = 0; |
| 171 | 200 | ||
| 172 | /** | 201 | /** |
| 173 | * Read data from the archive | 202 | * Read data from the archive |