GPU: Explicit RemovePathLimits() is no longer needed

This commit is contained in:
Stenzek 2024-05-23 19:52:56 +10:00
parent 10df7ba319
commit d2f28b6926
No known key found for this signature in database
2 changed files with 6 additions and 5 deletions

View File

@ -19,6 +19,7 @@
#include "util/state_wrapper.h"
#include "common/align.h"
#include "common/error.h"
#include "common/file_system.h"
#include "common/heap_array.h"
#include "common/log.h"
@ -2702,15 +2703,15 @@ bool GPU::RenderScreenshotToFile(std::string filename, DisplayScreenshotMode mod
if (!RenderScreenshotToBuffer(width, height, draw_rect, !internal_resolution, &pixels, &pixels_stride,
&pixels_format))
{
Log_ErrorPrintf("Failed to render %ux%u screenshot", width, height);
Log_ErrorFmt("Failed to render {}x{} screenshot", width, height);
return false;
}
// These filenames tend to be fairly long, so remove any MAX_PATH limit.
auto fp = FileSystem::OpenManagedCFile(Path::RemoveLengthLimits(filename).c_str(), "wb");
Error error;
auto fp = FileSystem::OpenManagedCFile(filename.c_str(), "wb", &error);
if (!fp)
{
Log_ErrorPrintf("Can't open file '%s': errno %d", filename.c_str(), errno);
Log_ErrorFmt("Can't open file '{}': {}", Path::GetFileName(filename), error.GetDescription());
return false;
}

View File

@ -4595,7 +4595,7 @@ bool System::SaveScreenshot(const char* filename, DisplayScreenshotMode mode, Di
// handle quick screenshots to the same filename
u32 next_suffix = 1;
while (FileSystem::FileExists(Path::RemoveLengthLimits(auto_filename).c_str()))
while (FileSystem::FileExists(auto_filename.c_str()))
{
auto_filename = fmt::format("{}" FS_OSPATH_SEPARATOR_STR "{} ({}).{}", EmuFolders::Screenshots, basename,
next_suffix, extension);