bool FRiderSourceCodeAccessor::OpenSourceFiles()

in Source/RiderSourceCodeAccess/Private/RiderSourceCodeAccessor.cpp [246:273]


bool FRiderSourceCodeAccessor::OpenSourceFiles(const TArray<FString>& AbsoluteSourcePaths)
{
	if (!bHasRiderInstalled) return false;
	
	TOptional<FString> OptionalSolutionPath = GetSolutionPath();
	if (!OptionalSolutionPath.IsSet()) return false;
	
	FString SolutionPath = OptionalSolutionPath.GetValue();
	
	if (FPaths::IsRelative(SolutionPath))
		SolutionPath = FPaths::ConvertRelativePathToFull(SolutionPath);

	FString FilePaths = "";
	for (const FString & FullPath : AbsoluteSourcePaths) {
		const TOptional<FString> OptionalPath = RSCA::ResolvePathToFile(FullPath);
		if(!OptionalPath.IsSet()) return false;
		const FString Path = OptionalPath.GetValue();
		FilePaths += FString::Printf(TEXT("\"%s\" "), *Path);
	}

	const FString Params = FString::Printf(TEXT("\"%s\" %s"), *SolutionPath, *FilePaths);
	const FString ErrorMessage = FString::Printf(TEXT("Opening files (%s) failed."), *FilePaths);

	return HandleOpeningRider([this, &Params, &ErrorMessage]()->bool
	{
		return RSCA::OpenRider(ExecutablePath, Params, ErrorMessage);
	});
}