From 9694c1aa04b0780dabe27c53bbef548fe877ce5c Mon Sep 17 00:00:00 2001 From: attila Date: Mon, 18 Dec 2023 17:29:52 +0100 Subject: [PATCH] build_tools: Fix Windows assertion when path contains ellipses A path of "$(SRCROOT)/../../SomeFile.cpp" would lose the fake C:\ prefix when the ellipses are collapsed, and trigger a non-absolute File assertion. --- .../juce_build_tools/utils/juce_RelativePath.h | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/extras/Build/juce_build_tools/utils/juce_RelativePath.h b/extras/Build/juce_build_tools/utils/juce_RelativePath.h index 0782845757..7a62768ae1 100644 --- a/extras/Build/juce_build_tools/utils/juce_RelativePath.h +++ b/extras/Build/juce_build_tools/utils/juce_RelativePath.h @@ -107,21 +107,12 @@ namespace juce::build_tools File getFakeFile() const { - #if JUCE_WINDOWS - if (isAbsolutePath (path)) - { - // This is a hack to convert unix-style absolute paths into valid absolute Windows paths to avoid hitting - // an assertion in File::parseAbsolutePath(). - if (path.startsWithChar (L'/') || path.startsWithChar (L'$') || path.startsWithChar (L'~')) - return File (String ("C:\\") + windowsStylePath (path.substring (1))); - - return File (path); - } - #endif + const auto unixStylePath = toUnixStyle(); + const auto name = unixStylePath.substring (unixStylePath.lastIndexOfChar ('/') + 1); // This method gets called very often, so we'll cache this directory. static const File currentWorkingDirectory (File::getCurrentWorkingDirectory()); - return currentWorkingDirectory.getChildFile (path); + return currentWorkingDirectory.getChildFile (name); } };