Exemplo n.º 1
0
        private static IEnumerable <string> /*!*/ GetAbsolutePaths(PlatformAdaptationLayer /*!*/ pal, string /*!*/ path)
        {
            if (pal.IsAbsolutePath(path))
            {
                yield return(path);
            }
            else
            {
                yield return(pal.GetFullPath(path));

                string var = pal.GetEnvironmentVariable("PATH");
                if (!String.IsNullOrEmpty(var))
                {
                    foreach (var prefix in var.Split(Path.PathSeparator))
                    {
                        if (prefix.Length > 0)
                        {
                            yield return(Path.Combine(prefix, path));
                        }
                    }
                }

                var = Environment.GetFolderPath(Environment.SpecialFolder.System);
                if (!String.IsNullOrEmpty(var))
                {
                    yield return(Path.Combine(var, path));
                }

                var = pal.GetEnvironmentVariable("SystemRoot");
                if (!String.IsNullOrEmpty(var))
                {
                    yield return(Path.Combine(var, path));
                }
            }
        }