From 137bb1e2aa9b1857614e10300af39c041cf6f047 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Fri, 23 Nov 2012 12:45:40 -0500 Subject: [PATCH] Extend CLI debug report command to optionally accept a report path. --- .../cli/CliDebugReportCommand.cpp | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/apps/debugger/user_interface/cli/CliDebugReportCommand.cpp b/src/apps/debugger/user_interface/cli/CliDebugReportCommand.cpp index 213b5f774d..62155a8402 100644 --- a/src/apps/debugger/user_interface/cli/CliDebugReportCommand.cpp +++ b/src/apps/debugger/user_interface/cli/CliDebugReportCommand.cpp @@ -28,12 +28,23 @@ CliDebugReportCommand::CliDebugReportCommand() void CliDebugReportCommand::Execute(int argc, const char* const* argv, CliContext& context) { - char buffer[B_FILE_NAME_LENGTH]; - UiUtils::ReportNameForTeam(context.GetTeam(), buffer, sizeof(buffer)); BPath path; - find_directory(B_DESKTOP_DIRECTORY, &path); - path.Append(buffer); + if (argc > 1) { + path.SetTo(argv[1]); + if (path.InitCheck() != B_OK) { + printf("Invalid report path %s given.\n", argv[1]); + return; + } + } else { + char buffer[B_FILE_NAME_LENGTH]; + UiUtils::ReportNameForTeam(context.GetTeam(), buffer, sizeof(buffer)); + find_directory(B_DESKTOP_DIRECTORY, &path); + path.Append(buffer); + } + entry_ref ref; - if (get_ref_for_path(path.Path(), &ref) == B_OK) + if (get_ref_for_path(path.Path(), &ref) == B_OK) { + printf("Saving debug information report to %s...\n", path.Path()); context.GetUserInterfaceListener()->DebugReportRequested(&ref); + } }