Skip to content

Commit

Permalink
fix: [run] incorret arguments when run/debug application
Browse files Browse the repository at this point in the history
Log: as title
  • Loading branch information
LiHua000 committed Jul 24, 2024
1 parent f374e9e commit 0a61661
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/plugins/cxx/cmake/cmakegenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ QMap<QString, QVariant> CMakeGenerator::getDebugArguments(const dpfservice::Proj
QMap<QString, QVariant> param;
param.insert("workspace", projectInfo.runWorkspaceDir());
param.insert("targetPath", projectInfo.runProgram());
param.insert("arguments", projectInfo.runCustomArgs());

return param;
}
Expand Down
7 changes: 5 additions & 2 deletions src/plugins/cxx/cmake/project/properties/configutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,11 @@ bool ConfigUtil::updateProjectInfo(dpfservice::ProjectInfo &info, const ProjectC
if (iterRun->targetName == iter->runConfigure.defaultTargetName) {
info.setRunProgram(iterRun->targetPath);
QStringList arguments;
if (!iterRun->arguments.isEmpty())
arguments << iterRun->arguments;
if (!iterRun->arguments.isEmpty()) {
auto args = iterRun->arguments.split(" ");
arguments = args;
arguments.removeAll("");
}
info.setRunCustomArgs(arguments);
info.setRunWorkspaceDir(iterRun->workDirectory);
info.setCurrentProgram(iterRun->targetName);
Expand Down
1 change: 1 addition & 0 deletions src/tools/debugadapter/dapsession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ void DapSession::registerHanlder()
QStringList arguments;
arguments.push_back(request.program.value().c_str());
if (request.args.has_value()) {
arguments.insert(0, "--args");
foreach(auto arg, request.args.value()) {
arguments.push_back(arg.c_str());
}
Expand Down

0 comments on commit 0a61661

Please sign in to comment.