From 519683b43a5ebfc6cbae9048d8b664da726e49ab Mon Sep 17 00:00:00 2001 From: Eran Ifrah Date: Fri, 25 Mar 2022 11:16:11 +0300 Subject: [PATCH] File System Workspace: executable arguments can now be placed on separate row, as well as on the same line --- CodeLite/clConsoleBase.cpp | 2 ++ Plugin/clFileSystemWorkspace.cpp | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/CodeLite/clConsoleBase.cpp b/CodeLite/clConsoleBase.cpp index d02070191e..f6e01f2491 100644 --- a/CodeLite/clConsoleBase.cpp +++ b/CodeLite/clConsoleBase.cpp @@ -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; diff --git a/Plugin/clFileSystemWorkspace.cpp b/Plugin/clFileSystemWorkspace.cpp index cab08386d9..44207e036c 100644 --- a/Plugin/clFileSystemWorkspace.cpp +++ b/Plugin/clFileSystemWorkspace.cpp @@ -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);