[FS] Use std::string over C strings for archive names

This commit is contained in:
wheremyfoodat 2022-12-12 03:50:38 +02:00
parent e1ac986009
commit 3d1aafa7dd
4 changed files with 6 additions and 5 deletions

View file

@ -1,5 +1,6 @@
#pragma once #pragma once
#include <optional> #include <optional>
#include <string>
#include "helpers.hpp" #include "helpers.hpp"
#include "memory.hpp" #include "memory.hpp"
@ -24,7 +25,7 @@ namespace ArchiveID {
SDMCWriteOnly = 0xA SDMCWriteOnly = 0xA
}; };
static const char* toString(u32 id) { static std::string toString(u32 id) {
switch (id) { switch (id) {
case SelfNCCH: return "SelfNCCH"; case SelfNCCH: return "SelfNCCH";
case SaveData: return "SaveData"; case SaveData: return "SaveData";
@ -72,7 +73,7 @@ protected:
Memory& mem; Memory& mem;
public: public:
virtual const char* name() = 0; virtual std::string name() = 0;
virtual u64 getFreeBytes() = 0; virtual u64 getFreeBytes() = 0;
virtual bool openFile(const FSPath& path) = 0; virtual bool openFile(const FSPath& path) = 0;

View file

@ -7,7 +7,7 @@ public:
SelfNCCHArchive(Memory& mem) : ArchiveBase(mem) {} SelfNCCHArchive(Memory& mem) : ArchiveBase(mem) {}
u64 getFreeBytes() override { return 0; } u64 getFreeBytes() override { return 0; }
const char* name() override { return "SelfNCCH"; } std::string name() override { return "SelfNCCH"; }
bool openFile(const FSPath& path) override; bool openFile(const FSPath& path) override;
ArchiveBase* openArchive(const FSPath& path) override; ArchiveBase* openArchive(const FSPath& path) override;

View file

@ -7,7 +7,7 @@ public:
SaveDataArchive(Memory& mem) : ArchiveBase(mem) {} SaveDataArchive(Memory& mem) : ArchiveBase(mem) {}
u64 getFreeBytes() override { return 0; } u64 getFreeBytes() override { return 0; }
const char* name() override { return "SaveData"; } std::string name() override { return "SaveData"; }
bool openFile(const FSPath& path) override; bool openFile(const FSPath& path) override;
ArchiveBase* openArchive(const FSPath& path) override; ArchiveBase* openArchive(const FSPath& path) override;

View file

@ -7,7 +7,7 @@ public:
SDMCArchive(Memory& mem) : ArchiveBase(mem) {} SDMCArchive(Memory& mem) : ArchiveBase(mem) {}
u64 getFreeBytes() override { return 0; } u64 getFreeBytes() override { return 0; }
const char* name() override { return "SDMC"; } std::string name() override { return "SDMC"; }
bool openFile(const FSPath& path) override; bool openFile(const FSPath& path) override;
ArchiveBase* openArchive(const FSPath& path) override; ArchiveBase* openArchive(const FSPath& path) override;