mirror of
https://github.com/AxioDL/nod.git
synced 2025-12-08 21:17:51 +00:00
Massive libfmt refactor
This commit is contained in:
@@ -101,7 +101,7 @@ Node::Node(const IPartition& parent, const FSTNode& node, std::string_view name)
|
||||
|
||||
std::unique_ptr<IPartReadStream> Node::beginReadStream(uint64_t offset) const {
|
||||
if (m_kind != Kind::File) {
|
||||
LogModule.report(logvisor::Error, "unable to stream a non-file %s", m_name.c_str());
|
||||
LogModule.report(logvisor::Error, fmt("unable to stream a non-file {}"), m_name);
|
||||
return std::unique_ptr<IPartReadStream>();
|
||||
}
|
||||
return m_parent.beginReadStream(m_discOffset + offset);
|
||||
@@ -109,7 +109,7 @@ std::unique_ptr<IPartReadStream> Node::beginReadStream(uint64_t offset) const {
|
||||
|
||||
std::unique_ptr<uint8_t[]> Node::getBuf() const {
|
||||
if (m_kind != Kind::File) {
|
||||
LogModule.report(logvisor::Error, "unable to buffer a non-file %s", m_name.c_str());
|
||||
LogModule.report(logvisor::Error, fmt("unable to buffer a non-file {}"), m_name);
|
||||
return std::unique_ptr<uint8_t[]>();
|
||||
}
|
||||
uint8_t* buf = new uint8_t[m_discLength];
|
||||
@@ -126,7 +126,7 @@ bool Node::extractToDirectory(SystemStringView basePath, const ExtractionContext
|
||||
if (ctx.progressCB && !getName().empty())
|
||||
ctx.progressCB(getName(), m_parent.m_curNodeIdx / float(m_parent.getNodeCount()));
|
||||
if (Mkdir(path.c_str(), 0755) && errno != EEXIST) {
|
||||
LogModule.report(logvisor::Error, _SYS_STR("unable to mkdir '%s'"), path.c_str());
|
||||
LogModule.report(logvisor::Error, fmt(_SYS_STR("unable to mkdir '{}'")), path);
|
||||
return false;
|
||||
}
|
||||
for (Node& subnode : *this)
|
||||
@@ -155,14 +155,14 @@ bool Node::extractToDirectory(SystemStringView basePath, const ExtractionContext
|
||||
bool IPartition::extractToDirectory(SystemStringView path, const ExtractionContext& ctx) {
|
||||
m_curNodeIdx = 0;
|
||||
if (Mkdir(path.data(), 0755) && errno != EEXIST) {
|
||||
LogModule.report(logvisor::Error, _SYS_STR("unable to mkdir '%s'"), path.data());
|
||||
LogModule.report(logvisor::Error, fmt(_SYS_STR("unable to mkdir '{}'")), path);
|
||||
return false;
|
||||
}
|
||||
|
||||
SystemString basePath = m_isWii ? SystemString(path) + _SYS_STR("/") + getKindString(m_kind) : SystemString(path);
|
||||
if (m_isWii) {
|
||||
if (Mkdir(basePath.c_str(), 0755) && errno != EEXIST) {
|
||||
LogModule.report(logvisor::Error, _SYS_STR("unable to mkdir '%s'"), basePath.c_str());
|
||||
LogModule.report(logvisor::Error, fmt(_SYS_STR("unable to mkdir '{}'")), basePath);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -181,7 +181,7 @@ bool IPartition::extractToDirectory(SystemStringView path, const ExtractionConte
|
||||
/* Extract Filesystem */
|
||||
SystemString fsPath = basePath + _SYS_STR("/files");
|
||||
if (Mkdir(fsPath.c_str(), 0755) && errno != EEXIST) {
|
||||
LogModule.report(logvisor::Error, _SYS_STR("unable to mkdir '%s'"), fsPath.c_str());
|
||||
LogModule.report(logvisor::Error, fmt(_SYS_STR("unable to mkdir '{}'")), fsPath);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ bool IPartition::extractToDirectory(SystemStringView path, const ExtractionConte
|
||||
bool IPartition::extractSysFiles(SystemStringView basePath, const ExtractionContext& ctx) const {
|
||||
SystemString basePathStr(basePath);
|
||||
if (Mkdir((basePathStr + _SYS_STR("/sys")).c_str(), 0755) && errno != EEXIST) {
|
||||
LogModule.report(logvisor::Error, _SYS_STR("unable to mkdir '%s/sys'"), basePath.data());
|
||||
LogModule.report(logvisor::Error, fmt(_SYS_STR("unable to mkdir '{}/sys'")), basePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -703,7 +703,7 @@ bool DiscBuilderBase::PartitionBuilderBase::RecursiveCalculateTotalSize(uint64_t
|
||||
|
||||
bool DiscBuilderBase::PartitionBuilderBase::buildFromDirectory(IPartWriteStream& ws, SystemStringView dirIn) {
|
||||
if (dirIn.empty()) {
|
||||
LogModule.report(logvisor::Error, _SYS_STR("all arguments must be supplied to buildFromDirectory()"));
|
||||
LogModule.report(logvisor::Error, fmt(_SYS_STR("all arguments must be supplied to buildFromDirectory()")));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -728,7 +728,7 @@ bool DiscBuilderBase::PartitionBuilderBase::buildFromDirectory(IPartWriteStream&
|
||||
{
|
||||
Sstat dolStat;
|
||||
if (Stat(dolIn.c_str(), &dolStat)) {
|
||||
LogModule.report(logvisor::Error, _SYS_STR("unable to stat %s"), dolIn.c_str());
|
||||
LogModule.report(logvisor::Error, fmt(_SYS_STR("unable to stat {}")), dolIn);
|
||||
return false;
|
||||
}
|
||||
size_t fileSz = ROUND_UP_32(dolStat.st_size);
|
||||
@@ -769,7 +769,7 @@ uint64_t DiscBuilderBase::PartitionBuilderBase::CalculateTotalSizeBuild(SystemSt
|
||||
|
||||
Sstat dolStat;
|
||||
if (Stat(dolIn.c_str(), &dolStat)) {
|
||||
LogModule.report(logvisor::Error, _SYS_STR("unable to stat %s"), dolIn.c_str());
|
||||
LogModule.report(logvisor::Error, fmt(_SYS_STR("unable to stat {}")), dolIn);
|
||||
return UINT64_MAX;
|
||||
}
|
||||
uint64_t totalSz = ROUND_UP_32(dolStat.st_size);
|
||||
@@ -781,7 +781,7 @@ uint64_t DiscBuilderBase::PartitionBuilderBase::CalculateTotalSizeBuild(SystemSt
|
||||
bool DiscBuilderBase::PartitionBuilderBase::mergeFromDirectory(IPartWriteStream& ws, const IPartition* partIn,
|
||||
SystemStringView dirIn) {
|
||||
if (dirIn.empty()) {
|
||||
LogModule.report(logvisor::Error, _SYS_STR("all arguments must be supplied to mergeFromDirectory()"));
|
||||
LogModule.report(logvisor::Error, fmt(_SYS_STR("all arguments must be supplied to mergeFromDirectory()")));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user