/// <summary> /// Return whether the path is valid /// </summary> protected bool pathValid() { if (Platform.IsMac) { // Handle default path dragged-and-dropped onto Mac's Terminal path.Value = path.Value.Replace("Kerbal\\ Space\\ Program", "Kerbal Space Program"); } if (!GameInstanceManager.IsGameInstanceDir(new DirectoryInfo(path.Value))) { // Complain about non-KSP path RaiseError("Path does not correspond to a game folder!"); SetFocus(path); return(false); } else { return(true); } }
/// <summary> /// Return whether the path is valid /// </summary> protected bool pathValid() { if (Platform.IsMac) { // Handle default path dragged-and-dropped onto Mac's Terminal path.Value = path.Value.Replace("Kerbal\\ Space\\ Program", "Kerbal Space Program"); } try { // DirectoryInfo's constructor throws exceptions for invalid characters, empty strings, etc. if (GameInstanceManager.IsGameInstanceDir(new DirectoryInfo(path.Value))) { return(true); } } catch { // Pretend DirectoryInfo constructed an instance that made IsGameInstanceDir return false } // Complain about non-KSP path RaiseError("Path does not correspond to a game folder!"); SetFocus(path); return(false); }