Browse Source

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.
v7.0.12
attila Attila Szarvas 1 year ago
parent
commit
9694c1aa04
1 changed files with 3 additions and 12 deletions
  1. +3
    -12
      extras/Build/juce_build_tools/utils/juce_RelativePath.h

+ 3
- 12
extras/Build/juce_build_tools/utils/juce_RelativePath.h 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);
}
};


Loading…
Cancel
Save