mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 16:32:39 +00:00
Place Log Backup Outside Emulator Init
This commit is contained in:
parent
8ddc545592
commit
1b6291329e
@ -132,6 +132,17 @@ static auto UserPaths = [] {
|
|||||||
return paths;
|
return paths;
|
||||||
}();
|
}();
|
||||||
|
|
||||||
|
void RenameLog() {
|
||||||
|
// Renaming shad_log.txt to shad_log.old.txt when booting.
|
||||||
|
const auto LogDir = Common::FS::GetUserPath(Common::FS::PathType::LogDir);
|
||||||
|
const auto CurrentLog = LogDir / LOG_FILE;
|
||||||
|
const auto NewLogName = LogDir / "shad_log.old.txt";
|
||||||
|
// Avoid crash due to shad_log.txt not existing.
|
||||||
|
if (std::filesystem::exists(CurrentLog)) {
|
||||||
|
rename(CurrentLog, NewLogName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool ValidatePath(const fs::path& path) {
|
bool ValidatePath(const fs::path& path) {
|
||||||
if (path.empty()) {
|
if (path.empty()) {
|
||||||
LOG_ERROR(Common_Filesystem, "Input path is empty, path={}", PathToUTF8String(path));
|
LOG_ERROR(Common_Filesystem, "Input path is empty, path={}", PathToUTF8String(path));
|
||||||
|
@ -48,6 +48,8 @@ constexpr auto METADATA_DIR = "game_data";
|
|||||||
// Filenames
|
// Filenames
|
||||||
constexpr auto LOG_FILE = "shad_log.txt";
|
constexpr auto LOG_FILE = "shad_log.txt";
|
||||||
|
|
||||||
|
void RenameLog();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validates a given path.
|
* Validates a given path.
|
||||||
*
|
*
|
||||||
|
@ -50,14 +50,8 @@ Emulator::Emulator() {
|
|||||||
SetPriorityClass(GetCurrentProcess(), ABOVE_NORMAL_PRIORITY_CLASS);
|
SetPriorityClass(GetCurrentProcess(), ABOVE_NORMAL_PRIORITY_CLASS);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Renaming shad_log.txt to shad_log.old.txt when booting.
|
// Rename shad_log.txt to shad_log.old.txt
|
||||||
const auto LogDir = Common::FS::GetUserPath(Common::FS::PathType::LogDir);
|
Common::FS::RenameLog();
|
||||||
const auto CurrentLog = LogDir / "shad_log.txt";
|
|
||||||
const auto NewLogName = LogDir / "shad_log.old.txt";
|
|
||||||
// Avoid crash due to shad_log.txt not existing.
|
|
||||||
if (std::filesystem::exists(CurrentLog)) {
|
|
||||||
rename(CurrentLog, NewLogName);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start logger.
|
// Start logger.
|
||||||
Common::Log::Initialize();
|
Common::Log::Initialize();
|
||||||
|
Loading…
Reference in New Issue
Block a user