Пример #1
0
        private static IEnumerable <string> /*!*/ GetExecutableFiles(PlatformAdaptationLayer /*!*/ pal, string /*!*/ path)
        {
            if (path[0] == '"' || path[path.Length - 1] == '"')
            {
                if (path.Length >= 3 && path[0] == '"' && path[path.Length - 1] == '"')
                {
                    path = path.Substring(1, path.Length - 2);
                }
                else
                {
                    yield break;
                }
            }

            string extension    = RubyUtils.GetExtension(path);
            bool   hasExtension = !String.IsNullOrEmpty(extension);
            bool   isExecutable = hasExtension && Array.IndexOf(_ExecutableExtensions, extension.ToLowerInvariant()) >= 0;

            if (!hasExtension || isExecutable)
            {
                foreach (var fullPath in GetAbsolutePaths(pal, path))
                {
                    if (hasExtension)
                    {
                        yield return(fullPath);
                    }
                    else
                    {
                        foreach (var ext in _ExecutableExtensions)
                        {
                            yield return(fullPath + ext);
                        }
                    }
                }
            }
        }