early-access version 1664

This commit is contained in:
pineappleEA
2021-05-08 09:49:31 +02:00
parent c6b346cfbb
commit 394300898e
72 changed files with 3883 additions and 791 deletions

View File

@@ -11,7 +11,9 @@
#include <fmt/ostream.h>
#include <nlohmann/json.hpp>
#include "common/file_util.h"
#include "common/fs/file.h"
#include "common/fs/fs.h"
#include "common/fs/path_util.h"
#include "common/hex_util.h"
#include "common/scm_rev.h"
#include "common/settings.h"
@@ -26,10 +28,9 @@
namespace {
std::string GetPath(std::string_view type, u64 title_id, std::string_view timestamp) {
return fmt::format("{}{}/{:016X}_{}.json",
Common::FS::GetUserPath(Common::FS::UserPath::LogDir), type, title_id,
timestamp);
std::filesystem::path GetPath(std::string_view type, u64 title_id, std::string_view timestamp) {
return Common::FS::GetYuzuPath(Common::FS::YuzuPath::LogDir) / type /
fmt::format("{:016X}_{}.json", title_id, timestamp);
}
std::string GetTimestamp() {
@@ -39,14 +40,16 @@ std::string GetTimestamp() {
using namespace nlohmann;
void SaveToFile(json json, const std::string& filename) {
if (!Common::FS::CreateFullPath(filename)) {
LOG_ERROR(Core, "Failed to create path for '{}' to save report!", filename);
void SaveToFile(json json, const std::filesystem::path& filename) {
if (!Common::FS::CreateParentDirs(filename)) {
LOG_ERROR(Core, "Failed to create path for '{}' to save report!",
Common::FS::PathToUTF8String(filename));
return;
}
std::ofstream file(
Common::FS::SanitizePath(filename, Common::FS::DirectorySeparator::PlatformDefault));
std::ofstream file;
Common::FS::OpenFileStream(file, filename, std::ios_base::out | std::ios_base::trunc);
file << std::setw(4) << json << std::endl;
}