FileSystem: Handle paths longer than MAX_PATH on Windows

This commit is contained in:
Stenzek
2024-03-29 16:07:54 +10:00
parent e5adb5452b
commit ab445ec69d
6 changed files with 150 additions and 59 deletions

View File

@ -1,16 +1,20 @@
// SPDX-FileCopyrightText: 2019-2022 Connor McLaughlin <stenzek@gmail.com>
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#include "platform_misc.h"
#include "common/file_system.h"
#include "common/log.h"
#include "common/small_string.h"
#include "common/string_util.h"
#include "platform_misc.h"
#include <cinttypes>
Log_SetChannel(PlatformMisc);
#include "common/windows_headers.h"
#include <mmsystem.h>
Log_SetChannel(PlatformMisc);
static bool SetScreensaverInhibitWin32(bool inhibit)
{
if (SetThreadExecutionState(ES_CONTINUOUS | (inhibit ? (ES_DISPLAY_REQUIRED | ES_SYSTEM_REQUIRED) : 0)) == NULL)
@ -51,6 +55,6 @@ void PlatformMisc::ResumeScreensaver()
bool PlatformMisc::PlaySoundAsync(const char* path)
{
const std::wstring wpath(StringUtil::UTF8StringToWideString(path));
const std::wstring wpath(FileSystem::GetWin32Path(path));
return PlaySoundW(wpath.c_str(), NULL, SND_ASYNC | SND_NODEFAULT);
}