Skip to content

Commit

Permalink
Fix string search method in #532
Browse files Browse the repository at this point in the history
Fix a bug that caused any egs++ application to crash immediately when
run. This happened due to a misuse of string method find_last_of instead
of method rfind to reverse-search for the ".exe" extension substring in
the application name.
  • Loading branch information
rtownson authored and ftessier committed Nov 21, 2019
1 parent 1bb0b12 commit 75638b6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions HEN_HOUSE/egs++/egs_application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,9 @@ EGS_Application::EGS_Application(int argc, char **argv) : input(0), geometry(0),
app_name = egsStripPath(argv[0]);

// In Windows PowerShell, we need to remove a .exe extension
size_t exePos = app_name.find_last_of(".exe");
size_t exePos = app_name.rfind(".exe");
if (exePos != string::npos) {
app_name = app_name.substr(0, exePos-3);
app_name = app_name.substr(0, exePos);
}
}
if (!app_name.size()) egsFatal("%s\n failed to determine application "
Expand Down

0 comments on commit 75638b6

Please sign in to comment.