in Source/RiderSourceCodeAccess/Private/RiderSourceCodeAccessor.cpp [30:57]
TOptional<FString> ResolvePathToFile(const FString& FullPath)
{
FString Path = FullPath;
if (FPaths::IsRelative(Path))
Path = FPaths::ConvertRelativePathToFull(Path);
if (!FPaths::FileExists(Path))
{
static const TArray<FString> SubDirs = {
"/Engine/Source/",
"/Engine/Plugins/"
};
FString EngineRootDir = FPaths::RootDir();
FPaths::NormalizeFilename(Path);
int32 Index = INDEX_NONE;
for (const FString& SubDir : SubDirs)
{
Index = Path.Find(SubDir);
if (Index != INDEX_NONE) break;
}
if (Index == INDEX_NONE) return {};
Path = EngineRootDir.Append(Path.RightChop(Index));
if (!FPaths::FileExists(Path)) return {};
}
return {Path};
}