Skip to content

Commit

Permalink
Fixed: The launcher creating another directory for thcrap sometimes.
Browse files Browse the repository at this point in the history
  • Loading branch information
David-JonesDVN committed Feb 2, 2022
1 parent a046ece commit d23e5ee
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Touhou Launcher/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
}

Expand All @@ -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
Expand All @@ -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);
}
}
Expand Down

0 comments on commit d23e5ee

Please sign in to comment.