Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 569b55aa authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Gracefully react to a lack of a working directory

Use the current directory instead, I have no idea what was I thinking
when I did this.
parent 2f558438
......@@ -1431,18 +1431,24 @@ int CMakeProjectVisitor::visit(const ExecuteProcessAst *exec)
QList<KProcess*> procs;
foreach(const QStringList& _args, exec->commands())
{
if (_args.isEmpty() || !QFile::exists(exec->workingDirectory()))
if(_args.isEmpty())
{
kDebug(9032) << "Error: trying to execute empty command";
break;
}
QString workingDir = exec->workingDirectory();
if(!QFile::exists(workingDir))
{
workingDir = m_vars->value("CMAKE_CURRENT_BINARY_DIR").join(QString());
}
QStringList args(_args);
KProcess *p=new KProcess(), *prev=0;
if(!procs.isEmpty())
{
prev=procs.last();
}
p->setWorkingDirectory(exec->workingDirectory());
p->setWorkingDirectory(workingDir);
p->setOutputChannelMode(KProcess::MergedChannels);
QString execName=args.takeFirst();
p->setProgram(execName, args);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment