string_util: Remove StringFromFormat() and related functions

Given we utilize fmt, we don't need to provide our own functions for formatting anymore
This commit is contained in:
Lioncash 2018-04-29 18:37:15 -04:00 committed by fearlessTobi
parent 22e172946b
commit 3284bef360
16 changed files with 56 additions and 135 deletions

View file

@ -5,6 +5,7 @@
#include <algorithm>
#include <memory>
#include <vector>
#include <fmt/format.h>
#include "common/common_types.h"
#include "common/file_util.h"
#include "common/logging/log.h"
@ -165,16 +166,15 @@ std::string GetExtSaveDataPath(const std::string& mount_point, const Path& path)
ExtSaveDataArchivePath path_data;
std::memcpy(&path_data, vec_data.data(), sizeof(path_data));
return Common::StringFromFormat("%s%08X/%08X/", mount_point.c_str(), path_data.save_high,
path_data.save_low);
return fmt::format("{}{:08x}/{:08x}/", mount_point.c_str(), path_data.save_high,
path_data.save_low);
}
std::string GetExtDataContainerPath(const std::string& mount_point, bool shared) {
if (shared)
return Common::StringFromFormat("%sdata/%s/extdata/", mount_point.c_str(), SYSTEM_ID);
return fmt::format("{}data/{}/extdata/", mount_point.c_str(), SYSTEM_ID);
return Common::StringFromFormat("%sNintendo 3DS/%s/%s/extdata/", mount_point.c_str(), SYSTEM_ID,
SDCARD_ID);
return fmt::format("{}Nintendo 3DS/{}/{}/extdata/", mount_point.c_str(), SYSTEM_ID, SDCARD_ID);
}
Path ConstructExtDataBinaryPath(u32 media_type, u32 high, u32 low) {

View file

@ -2,6 +2,7 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include <fmt/format.h>
#include "common/file_util.h"
#include "common/logging/log.h"
#include "common/string_util.h"
@ -18,22 +19,19 @@ namespace FileSys {
namespace {
std::string GetSaveDataContainerPath(const std::string& sdmc_directory) {
return Common::StringFromFormat("%sNintendo 3DS/%s/%s/title/", sdmc_directory.c_str(),
SYSTEM_ID, SDCARD_ID);
return fmt::format("{}Nintendo 3DS/{}/{}/title/", sdmc_directory.c_str(), SYSTEM_ID, SDCARD_ID);
}
std::string GetSaveDataPath(const std::string& mount_location, u64 program_id) {
u32 high = static_cast<u32>(program_id >> 32);
u32 low = static_cast<u32>(program_id & 0xFFFFFFFF);
return Common::StringFromFormat("%s%08x/%08x/data/00000001/", mount_location.c_str(), high,
low);
return fmt::format("{}{:08x}/{:08x}/data/00000001/", mount_location.c_str(), high, low);
}
std::string GetSaveDataMetadataPath(const std::string& mount_location, u64 program_id) {
u32 high = static_cast<u32>(program_id >> 32);
u32 low = static_cast<u32>(program_id & 0xFFFFFFFF);
return Common::StringFromFormat("%s%08x/%08x/data/00000001.metadata", mount_location.c_str(),
high, low);
return fmt::format("{}{:08x}/{:08x}/data/00000001.metadata", mount_location.c_str(), high, low);
}
} // namespace

View file

@ -6,6 +6,7 @@
#include <cstring>
#include <memory>
#include <vector>
#include <fmt/format.h>
#include "common/common_types.h"
#include "common/file_util.h"
#include "common/string_util.h"
@ -25,11 +26,11 @@ std::string GetSystemSaveDataPath(const std::string& mount_point, const Path& pa
u32 save_high;
std::memcpy(&save_low, &vec_data[4], sizeof(u32));
std::memcpy(&save_high, &vec_data[0], sizeof(u32));
return Common::StringFromFormat("%s%08X/%08X/", mount_point.c_str(), save_low, save_high);
return fmt::format("{}{:08X}/{:08X}/", mount_point.c_str(), save_low, save_high);
}
std::string GetSystemSaveDataContainerPath(const std::string& mount_point) {
return Common::StringFromFormat("%sdata/%s/sysdata/", mount_point.c_str(), SYSTEM_ID);
return fmt::format("{}data/{}/sysdata/", mount_point.c_str(), SYSTEM_ID);
}
Path ConstructSystemSaveDataBinaryPath(u32 high, u32 low) {