Skip to content

Commit

Permalink
Check for tf_win64.exe
Browse files Browse the repository at this point in the history
Fixes #6
  • Loading branch information
cooolbros committed Apr 19, 2024
1 parent 41a637f commit ccd7d90
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/HUDMerger/Commands/MergeCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,26 @@ static bool PathContainsPath(string parentDir, string subDir)
return !relativeDirectory.StartsWith("..") && !Path.IsPathRooted(relativeDirectory);
}

if (PathContainsPath(Path.Join(((App)Application.Current).Settings.Value.TeamFortress2Folder, "tf\\custom"), _mainWindowViewModel.TargetHUD!.FolderPath) && Process.GetProcessesByName("hl2").Length != 0)
bool teamFortress2FolderContainsTarget = PathContainsPath(Path.Join(((App)Application.Current).Settings.Value.TeamFortress2Folder, "tf\\custom"), _mainWindowViewModel.TargetHUD!.FolderPath);

Process[] processes;

if (teamFortress2FolderContainsTarget)
{
processes = [
..Process.GetProcessesByName("hl2"),
..Process.GetProcessesByName("tf"),
..Process.GetProcessesByName("tf_win64"),
];
}
else
{
processes = [];
}

if (teamFortress2FolderContainsTarget && processes.Length != 0)
{
MessageBox.Show("HL2 process open, cannot merge!", "HL2 Open Error", MessageBoxButton.OK, MessageBoxImage.Error);
MessageBox.Show("TF2 process open, cannot merge!", "TF2 Open Error", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
#endif
Expand Down

0 comments on commit ccd7d90

Please sign in to comment.