mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-28 22:06:59 +01:00
fix File abstraction destructor
This commit is contained in:
+1
-1
@@ -69,7 +69,7 @@ File::File(): m_p(std::make_unique<FilePrivate>()) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
File::~File() {
|
File::~File() {
|
||||||
EXIT_IF(m_p->f != nullptr);
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
File::File(const std::filesystem::path& name): m_p(std::make_unique<FilePrivate>()) {
|
File::File(const std::filesystem::path& name): m_p(std::make_unique<FilePrivate>()) {
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ void DumpShaderSpirv(const char* stage_name, uint64_t shader_hash,
|
|||||||
const auto path = Config::GetShaderLogFolder() / fmt::format("{:04d}_new_shader_{}_{:016x}.spv",
|
const auto path = Config::GetShaderLogFolder() / fmt::format("{:04d}_new_shader_{}_{:016x}.spv",
|
||||||
id++, stage_name, shader_hash);
|
id++, stage_name, shader_hash);
|
||||||
Common::File::CreateDirectories(path.parent_path());
|
Common::File::CreateDirectories(path.parent_path());
|
||||||
Common::File file(path, Common::File::Mode::Write);
|
Common::File file(path);
|
||||||
if (file.IsInvalid()) {
|
if (file.IsInvalid()) {
|
||||||
const auto path_text = Common::PathToString(path);
|
const auto path_text = Common::PathToString(path);
|
||||||
LOGF_COLOR(Log::Color::BrightRed, "Can't create file: %s\n", path_text.c_str());
|
LOGF_COLOR(Log::Color::BrightRed, "Can't create file: %s\n", path_text.c_str());
|
||||||
@@ -131,7 +131,7 @@ void DumpShaderOriginal(const char* stage_name, uint64_t shader_hash,
|
|||||||
}
|
}
|
||||||
auto path = base;
|
auto path = base;
|
||||||
path += suffix;
|
path += suffix;
|
||||||
Common::File file(path, Common::File::Mode::Write);
|
Common::File file(path);
|
||||||
if (file.IsInvalid()) {
|
if (file.IsInvalid()) {
|
||||||
const auto path_text = Common::PathToString(path);
|
const auto path_text = Common::PathToString(path);
|
||||||
LOGF_COLOR(Log::Color::BrightRed, "Can't create file: %s\n", path_text.c_str());
|
LOGF_COLOR(Log::Color::BrightRed, "Can't create file: %s\n", path_text.c_str());
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ void CheckSaveRename(const std::filesystem::path &root,
|
|||||||
Common::File result(root / "SDATA000.DAT", Common::File::Mode::Read);
|
Common::File result(root / "SDATA000.DAT", Common::File::Mode::Read);
|
||||||
Check(!result.IsInvalid(), "open renamed save file");
|
Check(!result.IsInvalid(), "open renamed save file");
|
||||||
const auto data = result.ReadWholeBuffer();
|
const auto data = result.ReadWholeBuffer();
|
||||||
result.Close();
|
|
||||||
const std::string expected = std::string(payload) + Suffix;
|
const std::string expected = std::string(payload) + Suffix;
|
||||||
Check(data.Size() == expected.size(), "renamed save size");
|
Check(data.Size() == expected.size(), "renamed save size");
|
||||||
Check(std::memcmp(data.GetData(), expected.data(), expected.size()) == 0,
|
Check(std::memcmp(data.GetData(), expected.data(), expected.size()) == 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user