1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

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.
This commit is contained in:
attila 2023-12-18 17:29:52 +01:00 committed by Attila Szarvas
parent b0167985b4
commit 9694c1aa04

View file

@ -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);
}
};