Skip to content

Commit

Permalink
File System Workspace: executable arguments can now be placed on sepa…
Browse files Browse the repository at this point in the history
…rate row, as well as on the same line
  • Loading branch information
eranif committed Mar 25, 2022
1 parent 8f05303 commit 519683b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CodeLite/clConsoleBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ bool clConsoleBase::StartProcess(const wxString& command)
callback = new ConsoleProcess(m_sink, m_callbackUID);
}

clDEBUG() << "Console: running command: `" << command << "`" << endl;

SetPid(::wxExecute(command, wxEXEC_ASYNC | wxEXEC_MAKE_GROUP_LEADER | GetExecExtraFlags(), callback));
// reset the m_callback (it will auto-delete itself)
m_callback = nullptr;
Expand Down
16 changes: 16 additions & 0 deletions Plugin/clFileSystemWorkspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1009,6 +1009,22 @@ void clFileSystemWorkspace::GetExecutable(wxString& exe, wxString& args, wxStrin
args = GetConfig()->GetArgs();
wd = GetConfig()->GetWorkingDirectory().IsEmpty() ? GetFileName().GetPath() : GetConfig()->GetWorkingDirectory();

// build the arguments
args.Replace("\r", wxEmptyString);
args.Replace("\n", " ");
auto args_arr = StringUtils::BuildArgv(args);

args.clear();
for(auto& arg : args_arr) {
if(!args.empty()) {
args << " ";
}
arg.Trim().Trim(false);
// wrap with quotes if required
::WrapWithQuotes(arg);
args << arg;
}

exe = MacroManager::Instance()->Expand(exe, nullptr, wxEmptyString);
args = MacroManager::Instance()->Expand(args, nullptr, wxEmptyString);
wd = MacroManager::Instance()->Expand(wd, nullptr, wxEmptyString);
Expand Down

0 comments on commit 519683b

Please sign in to comment.