Skip to content

Commit

Permalink
ソフトのパスの空白文字の対策を追加
Browse files Browse the repository at this point in the history
  • Loading branch information
puk06 committed Jul 19, 2024
1 parent 64caaba commit 00e89c5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
1 change: 0 additions & 1 deletion Forms/AddSoftware.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Forms/AddSoftware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ private IEnumerable<string> CheckValue()
Main.AddValueToArray(ref reasons, "❌️ Path does not exist");
}

if (PATH_TEXTBOX.Text.Contains("ㅤ"))
{
Main.AddValueToArray(ref reasons, "❌️ Path contains invalid characters");
}

return reasons;
}

Expand Down
5 changes: 5 additions & 0 deletions Forms/EditSoftware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ private IEnumerable<string> CheckValue()
Main.AddValueToArray(ref reasons, "❌️ Path does not exist");
}

if (PATH_TEXTBOX.Text.Contains("ㅤ"))
{
Main.AddValueToArray(ref reasons, "❌️ Path contains invalid characters");
}

return reasons;
}

Expand Down
3 changes: 2 additions & 1 deletion Forms/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,8 @@ private void LaunchSoftwares()
if (software.Name != checkBox.Name) continue;
string softwarePath = software.Path;
string workingDirectory = Path.GetDirectoryName(softwarePath);
if (!File.Exists(softwarePath) || string.IsNullOrEmpty(workingDirectory)) continue;
if (!File.Exists(softwarePath) || string.IsNullOrEmpty(workingDirectory))
throw new Exception("The software could not be found.");
ProcessStartInfo softwareStartInfo = new ProcessStartInfo
{
FileName = softwarePath,
Expand Down

0 comments on commit 00e89c5

Please sign in to comment.