public bool TryResolve()

in TeamCity.CSharpInteractive/FilePathResolver.cs [20:54]


    public bool TryResolve(string? fileOrDirectoryPath, out string fullScriptPath)
    {
        var state = State.Unknown;
        fullScriptPath = string.Empty;
        if (!string.IsNullOrWhiteSpace(fileOrDirectoryPath))
        {
            if (_fileSystem.IsPathRooted(fileOrDirectoryPath))
            {
                state = TryResolveFullPath(fileOrDirectoryPath, fileOrDirectoryPath, out fullScriptPath);
                if (state == State.NotFound)
                {
                    return false;
                }
            }
            else
            {
                foreach (var path in GetPaths().Distinct())
                {
                    fullScriptPath = Path.Combine(path, fileOrDirectoryPath);
                    state = TryResolveFullPath(path, fullScriptPath, out fullScriptPath);
                    if (state is State.Found or State.Error)
                    {
                        break;
                    }
                }
            }
        }

        if (state is State.NotFound)
        {
            _log.Error(ErrorId.CannotFind, $"Cannot find \"{fileOrDirectoryPath}\".");
        }
        
        return state == State.Found;
    }