private static int ResolveAbsoluteNonQuoted(string value, out string fullCommandPath) { foreach (var segment in GetSegments(value)) { bool relaxed = segment.HasExtension || segment.Final; if (PathResolveHelper.TryResolveAbsolutePath(segment.Path, segment.HasExtension, relaxed, out fullCommandPath)) { return(segment.Index); } } fullCommandPath = null; return(-1); }
private int ResolveQuoted(string value, string workingDir, out string fullCommandPath) { fullCommandPath = null; if (value.Length == 1) { return(-1); } var closeIx = value.IndexOf('"', 1); if (closeIx == -1) { return(-1); } value = value.Substring(1, closeIx - 1); if (string.IsNullOrEmpty(value)) { return(-1); } if (PathResolveHelper.IsAbsolutePath(value)) { var hasExtesion = PathResolveHelper.HasWhatLookLikeExtesion(value); if (PathResolveHelper.TryResolveAbsolutePath(value, hasExtesion, true, out fullCommandPath)) { return(closeIx); } } else { if (ResolveRelativeQuoted(value, workingDir, out fullCommandPath)) { return(closeIx); } } return(-1); }