mirror of
https://github.com/PCSX2/pcsx2.git
synced 2024-10-06 23:13:25 +00:00
Common: Fix Recursive CreateDirectoryPath() on Windows
Some checks failed
🖥️ Windows Builds / Lint VS Project Files (push) Waiting to run
🖥️ Windows Builds / SSE4 (push) Blocked by required conditions
🖥️ Windows Builds / AVX2 (push) Blocked by required conditions
🐧 Linux Builds / AppImage (push) Has been skipped
🐧 Linux Builds / Flatpak (push) Has been skipped
🍎 MacOS Builds / Defaults (push) Has been skipped
🖥️ Windows Builds / CMake (push) Has been skipped
🌎 Update Base Translation / Update Base Translation (push) Failing after 0s
📦 Publish Flathub Release / Check if release is needed (push) Failing after 0s
📦 Publish Flathub Release / Build and publish Flatpak (push) Has been skipped
Some checks failed
🖥️ Windows Builds / Lint VS Project Files (push) Waiting to run
🖥️ Windows Builds / SSE4 (push) Blocked by required conditions
🖥️ Windows Builds / AVX2 (push) Blocked by required conditions
🐧 Linux Builds / AppImage (push) Has been skipped
🐧 Linux Builds / Flatpak (push) Has been skipped
🍎 MacOS Builds / Defaults (push) Has been skipped
🖥️ Windows Builds / CMake (push) Has been skipped
🌎 Update Base Translation / Update Base Translation (push) Failing after 0s
📦 Publish Flathub Release / Check if release is needed (push) Failing after 0s
📦 Publish Flathub Release / Build and publish Flatpak (push) Has been skipped
This commit is contained in:
parent
4e1979427d
commit
0cf4b76876
@ -1732,8 +1732,26 @@ bool FileSystem::CreateDirectoryPath(const char* Path, bool Recursive, Error* er
|
|||||||
std::wstring tempPath;
|
std::wstring tempPath;
|
||||||
tempPath.reserve(pathLength);
|
tempPath.reserve(pathLength);
|
||||||
|
|
||||||
|
// for absolute paths, we need to skip over the path root
|
||||||
|
size_t rootLength = 0;
|
||||||
|
if (Path::IsAbsolute(Path))
|
||||||
|
{
|
||||||
|
const wchar_t* root_start = wpath.c_str();
|
||||||
|
wchar_t* root_end;
|
||||||
|
const HRESULT hr = PathCchSkipRoot(const_cast<wchar_t*>(root_start), &root_end);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
Error::SetHResult(error, "PathCchSkipRoot() failed: ", hr);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
rootLength = static_cast<size_t>(root_end - root_start);
|
||||||
|
|
||||||
|
// copy path root
|
||||||
|
tempPath.append(wpath, 0, rootLength);
|
||||||
|
}
|
||||||
|
|
||||||
// create directories along the path
|
// create directories along the path
|
||||||
for (size_t i = 0; i < pathLength; i++)
|
for (size_t i = rootLength; i < pathLength; i++)
|
||||||
{
|
{
|
||||||
if (wpath[i] == L'\\' || wpath[i] == L'/')
|
if (wpath[i] == L'\\' || wpath[i] == L'/')
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user