From 2214cb57eeed6481d73b5ef887b3ce27d47eaf8f Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Tue, 25 Jun 2013 16:57:27 -0400 Subject: [PATCH] Fix regression introduced in 21d8063. We can't use BPath to get the filename for the source file path embedded in the debug information, since it may be relative, which BPath will try to normalize. --- .../gui/team_window/TeamWindow.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp b/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp index 7b456474d6..948351aa38 100644 --- a/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp @@ -1459,18 +1459,20 @@ TeamWindow::_HandleResolveMissingSourceFile(entry_ref& locatedPath) if (sourceFile != NULL) { BString sourcePath; sourceFile->GetPath(sourcePath); - BPath sourceFilePath(sourcePath); - BPath targetFilePath(&locatedPath); - if (sourceFilePath.InitCheck() != B_OK - || targetFilePath.InitCheck() != B_OK) { - return; - } + BString sourceFileName(sourcePath); + int32 index = sourcePath.FindLast('/'); + if (index >= 0) + sourceFileName.Remove(0, index + 1); - if (strcmp(sourceFilePath.Leaf(), targetFilePath.Leaf()) != 0) { + BPath targetFilePath(&locatedPath); + if (targetFilePath.InitCheck() != B_OK) + return; + + if (strcmp(sourceFileName.String(), targetFilePath.Leaf()) != 0) { BString message; message.SetToFormat("The names of source file '%s' and located" " file '%s' differ. Use file anyway?", - sourceFilePath.Leaf(), targetFilePath.Leaf()); + sourceFileName.String(), targetFilePath.Leaf()); BAlert* alert = new(std::nothrow) BAlert( "Source path mismatch", message.String(), "Cancel", "Use"); if (alert == NULL)