in TeamCity.CSharpInteractive/FilePathResolver.cs [56:87]
private State TryResolveFullPath(string basePath, string fullPath, out string fullScriptPath)
{
fullScriptPath = string.Empty;
var isFileExist = _fileSystem.IsFileExist(fullPath);
_log.Trace(() => new[] {new Text($"Try to find file \"{fullPath}\" in \"{basePath}\": {isFileExist}.")});
if (isFileExist)
{
fullScriptPath = fullPath;
return State.Found;
}
var isDirectoryExist = _fileSystem.IsDirectoryExist(fullPath);
_log.Trace(() => new[] {new Text($"Try to find directory \"{fullPath}\" in \"{basePath}\": {isDirectoryExist}.")});
if (isDirectoryExist)
{
var scripts = _fileSystem.EnumerateFileSystemEntries(fullPath, "*.csx", SearchOption.TopDirectoryOnly).ToList();
switch (scripts.Count)
{
case 1:
fullScriptPath = scripts[0];
return State.Found;
case > 1:
_log.Error(ErrorId.CannotFind, new Text($"Specify which script file to use because the folder \"{fullPath}\" contains more than one script file."));
return State.Error;
default:
return State.Unknown;
}
}
return State.NotFound;
}