Esempio n. 1
0
        /// <summary>
        /// Attempts to automatically find a KSP install on this system.
        /// Returns the path to the install on success.
        /// Throws a DirectoryNotFoundException on failure.
        /// </summary>
        public static string FindGameDir()
        {
            // See if we can find KSP as part of a Steam install.
            string kspSteamPath = KSPPathUtils.KSPSteamPath();

            if (kspSteamPath != null)
            {
                if (IsKspDir(kspSteamPath))
                {
                    return(kspSteamPath);
                }

                log.DebugFormat("Have Steam, but KSP is not at \"{0}\".", kspSteamPath);
            }

            // See if we can find a non-Steam Mac KSP install
            string kspMacPath = KSPPathUtils.KSPMacPath();

            if (kspMacPath != null)
            {
                if (IsKspDir(kspMacPath))
                {
                    log.InfoFormat("Found a KSP install at {0}", kspMacPath);
                    return(kspMacPath);
                }
                log.DebugFormat("Default Mac KSP folder exists at \"{0}\", but KSP is not installed there.", kspMacPath);
            }

            // Oh noes! We can't find KSP!
            throw new DirectoryNotFoundException();
        }