diff --git a/Touhou Launcher/MainForm.cs b/Touhou Launcher/MainForm.cs index 3a2c385..8aba9bb 100644 --- a/Touhou Launcher/MainForm.cs +++ b/Touhou Launcher/MainForm.cs @@ -1003,7 +1003,8 @@ private void browse_Click(object sender, EventArgs e) txtbox.BackColor = SystemColors.Window; txtbox.Text = file; curCfg.np2Dir = np2Dir.Text; - curCfg.crapDir = Path.GetDirectoryName(crapDir.Text).TrimEnd("\\bin".ToCharArray()); + string crapPath = Path.GetDirectoryName(crapDir.Text); + curCfg.crapDir = (Directory.Exists(crapPath + "\\bin") || !crapPath.EndsWith("\\bin")) ? crapPath : crapPath.Substring(0, crapPath.LastIndexOf("\\bin")); } } @@ -1013,8 +1014,8 @@ private void Dir_LostFocus(object sender, EventArgs e) { ((TextBox)sender).BackColor = SystemColors.Window; curCfg.np2Dir = np2Dir.Text; - string crapPath = crapDir.Text == "" ? "" : Path.GetDirectoryName(crapDir.Text); - curCfg.crapDir = Directory.Exists(crapPath + "\\bin") ? crapPath : crapPath.TrimEnd("\\bin".ToCharArray()); + string crapPath = Path.GetDirectoryName(crapDir.Text); + curCfg.crapDir = (Directory.Exists(crapPath + "\\bin") || !crapPath.EndsWith("\\bin")) ? crapPath : crapPath.Substring(0, crapPath.LastIndexOf("\\bin")); curCfg.StartingRepo = crapStartingRepo.Text; } else @@ -1032,7 +1033,9 @@ private void crapConfigure_Click(object sender, EventArgs e) if (curCfg.crapDir != "") { string procDir = curCfg.crapDir + "\\bin\\thcrap_configure.exe"; - if (File.Exists(procDir)) + if (!File.Exists(procDir)) + MessageBox.Show(rm.GetString("errorcrapNotFound")); + else startProcess(procDir); } }