From db5a43db30fc1d1a05018be032d3aff55c3575df Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Sun, 24 Dec 2023 17:48:40 +0000 Subject: [PATCH] Allow top-level prefix to be found in the middle of a path --- components/misc/resourcehelpers.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/components/misc/resourcehelpers.cpp b/components/misc/resourcehelpers.cpp index 7386dceb9f..c9a3591046 100644 --- a/components/misc/resourcehelpers.cpp +++ b/components/misc/resourcehelpers.cpp @@ -75,6 +75,17 @@ std::string Misc::ResourceHelpers::correctResourcePath( needsPrefix = false; break; } + else + { + std::string topLevelPrefix = std::string{ potentialTopLevelDirectory } + '\\'; + size_t topLevelPos = correctedPath.find('\\' + topLevelPrefix); + if (topLevelPos != std::string::npos) + { + correctedPath.erase(0, topLevelPos + 1); + needsPrefix = false; + break; + } + } } if (needsPrefix) correctedPath = std::string{ topLevelDirectories.front() } + '\\' + correctedPath;