Don't recreate directories on each shader dumped

Wasn't aware that directories were already created.
This commit is contained in:
Crementif 2025-01-04 20:05:57 +01:00
parent d774d3feca
commit 6d6eb066f1
2 changed files with 3 additions and 11 deletions

View file

@ -452,10 +452,7 @@ void LatteShader_DumpShader(uint64 baseHash, uint64 auxHash, LatteDecompilerShad
else if (shader->shaderType == LatteConst::ShaderType::Pixel) else if (shader->shaderType == LatteConst::ShaderType::Pixel)
suffix = "ps"; suffix = "ps";
fs::path shaderPath = ActiveSettings::GetUserDataPath("dump/shaders"); FileStream* fs = FileStream::createFile2(ActiveSettings::GetUserDataPath("dump/shaders/{:016x}_{:016x}_{}.txt", baseHash, auxHash, suffix));
std::error_code ec;
fs::create_directories(shaderPath, ec);
FileStream* fs = FileStream::createFile2(shaderPath / fmt::format("{:016x}_{:016x}_{}.txt", baseHash, auxHash, suffix));
if (fs) if (fs)
{ {
if (shader->strBuf_shaderSource) if (shader->strBuf_shaderSource)
@ -482,10 +479,7 @@ void LatteShader_DumpRawShader(uint64 baseHash, uint64 auxHash, uint32 type, uin
else if (type == SHADER_DUMP_TYPE_COMPUTE) else if (type == SHADER_DUMP_TYPE_COMPUTE)
suffix = "compute"; suffix = "compute";
fs::path shaderPath = ActiveSettings::GetUserDataPath("dump/shaders"); FileStream* fs = FileStream::createFile2(ActiveSettings::GetUserDataPath("dump/shaders/{:016x}_{:016x}_{}.bin", baseHash, auxHash, suffix));
std::error_code ec;
fs::create_directories(shaderPath, ec);
FileStream* fs = FileStream::createFile2(shaderPath / fmt::format("{:016x}_{:016x}_{}.bin", baseHash, auxHash, suffix));
if (fs) if (fs)
{ {
fs->writeData(programCode, programLen); fs->writeData(programCode, programLen);

View file

@ -1113,9 +1113,7 @@ void MainWindow::OnDebugDumpUsedShaders(wxCommandEvent& event)
{ {
try try
{ {
// create directory fs::create_directories(ActiveSettings::GetUserDataPath("dump/shaders"));
const fs::path path(ActiveSettings::GetUserDataPath());
fs::create_directories(path / "dump" / "shaders");
} }
catch (const std::exception & ex) catch (const std::exception & ex)
{ {