GetCanonicalPath() public static méthode

public static GetCanonicalPath ( String path ) : String
path String
Résultat String
Exemple #1
0
        public static void FindApacheInDir(String dir, ArrayList homes)
        {
            String[] groupDirs = Directory.GetDirectories(dir, "Apache*");

            foreach (String groupDir in groupDirs)
            {
                String[] testDirs = Directory.GetDirectories(groupDir, "*");
                foreach (String testDir in testDirs)
                {
                    if (File.Exists(testDir + @"\bin\Apache.exe") || File.Exists(testDir + @"\bin\httpd.exe"))
                    {
                        homes.Add(Util.GetCanonicalPath(testDir));
                    }
                }
            }
        }
Exemple #2
0
        public static void FindApache(ArrayList homes)
        {
            String apacheHome = null;

            apacheHome = FindApacheInRegistry(Registry.LocalMachine, REG_APACHE_2_2);

            if (apacheHome != null)
            {
                homes.Add(Util.GetCanonicalPath(apacheHome));
            }

            apacheHome = FindApacheInRegistry(Registry.CurrentUser, REG_APACHE_2_2);

            if (apacheHome != null)
            {
                homes.Add(Util.GetCanonicalPath(apacheHome));
            }

            apacheHome = FindApacheInRegistry(Registry.LocalMachine, REG_APACHE_2);

            if (apacheHome != null)
            {
                homes.Add(Util.GetCanonicalPath(apacheHome));
            }

            apacheHome = FindApacheInRegistry(Registry.CurrentUser, REG_APACHE_2);
            if (apacheHome != null)
            {
                homes.Add(Util.GetCanonicalPath(apacheHome));
            }

            String dir
                = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);

            FindApacheInDir(dir, homes);

            dir = dir + " (x86)";
            if (Directory.Exists(dir))
            {
                FindApacheInDir(dir, homes);
            }

            DriveInfo[] drives = DriveInfo.GetDrives();
            foreach (DriveInfo drive in drives)
            {
                if (DriveType.Fixed != drive.DriveType && DriveType.Ram != drive.DriveType)
                {
                    continue;
                }
                DirectoryInfo   root        = drive.RootDirectory;
                DirectoryInfo[] directories = root.GetDirectories();
                foreach (DirectoryInfo directory in directories)
                {
                    if (directory.Name.Contains("appservers"))
                    {
                        DirectoryInfo[] appserverDirectories = directory.GetDirectories();
                        foreach (DirectoryInfo appserverDir in appserverDirectories)
                        {
                            if (IsValidApacheHome(appserverDir.FullName))
                            {
                                String home = Util.Canonicalize(appserverDir.FullName);
                                if (!homes.Contains(home))
                                {
                                    homes.Add(home);
                                }
                            }
                        }
                    }
                }
            }
        }