コード例 #1
0
 private int ResolveNonQuoted(string value, string workingDir, out string fullCommandPath)
 {
     if (PathResolveHelper.IsAbsolutePath(value))
     {
         return(ResolveAbsoluteNonQuoted(value, out fullCommandPath));
     }
     else
     {
         return(ResolveRelativeNonQuoted(value, workingDir, out fullCommandPath));
     }
 }
コード例 #2
0
        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);
        }