forked from qt-creator/qt-creator
ProjectExplorer: Ensure working dir is reachable
Previously the working directory might not be reachable by the executable. This change fixes that by calling "ensureReachable", and changing the path to an on-device path of the exectuable. This also fixes the path when the Host is Windows, and the build device is a unix type system by changing the paths from e.g. "c:/..." to "/c/..." Change-Id: I6c86e16c867bb654b6c2a4951d9f62fdb879298e Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -152,7 +152,8 @@ bool AbstractProcessStep::init()
|
||||
if (d->m_process)
|
||||
return false;
|
||||
|
||||
setupProcessParameters(processParameters());
|
||||
if (!setupProcessParameters(processParameters()))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -233,7 +234,7 @@ ProcessParameters *AbstractProcessStep::processParameters()
|
||||
return &d->m_param;
|
||||
}
|
||||
|
||||
void AbstractProcessStep::setupProcessParameters(ProcessParameters *params) const
|
||||
bool AbstractProcessStep::setupProcessParameters(ProcessParameters *params) const
|
||||
{
|
||||
params->setMacroExpander(macroExpander());
|
||||
|
||||
@@ -242,13 +243,21 @@ void AbstractProcessStep::setupProcessParameters(ProcessParameters *params) cons
|
||||
d->m_environmentModifier(env);
|
||||
params->setEnvironment(env);
|
||||
|
||||
if (d->m_workingDirectoryProvider)
|
||||
params->setWorkingDirectory(d->m_workingDirectoryProvider());
|
||||
else
|
||||
params->setWorkingDirectory(buildDirectory());
|
||||
|
||||
if (d->m_commandLineProvider)
|
||||
params->setCommandLine(d->m_commandLineProvider());
|
||||
|
||||
FilePath workingDirectory;
|
||||
if (d->m_workingDirectoryProvider)
|
||||
workingDirectory = d->m_workingDirectoryProvider();
|
||||
else
|
||||
workingDirectory = buildDirectory();
|
||||
|
||||
const FilePath executable = params->effectiveCommand();
|
||||
|
||||
QTC_ASSERT(executable.ensureReachable(workingDirectory), return false);
|
||||
params->setWorkingDirectory(workingDirectory.onDevice(executable));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void AbstractProcessStep::Private::cleanUp(int exitCode, QProcess::ExitStatus status)
|
||||
|
@@ -21,7 +21,7 @@ class PROJECTEXPLORER_EXPORT AbstractProcessStep : public BuildStep
|
||||
|
||||
public:
|
||||
ProcessParameters *processParameters();
|
||||
void setupProcessParameters(ProcessParameters *params) const;
|
||||
bool setupProcessParameters(ProcessParameters *params) const;
|
||||
|
||||
bool ignoreReturnValue() const;
|
||||
void setIgnoreReturnValue(bool b);
|
||||
|
Reference in New Issue
Block a user