VCSBase: fix working dir in VCSBaseClient::view()

The working directory for the job was wrong in the case where the
source argument is already a path. The fix tests file/dir nature of the
source and ensures a valid path is given to the job command.

Merge-request: 281
Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
cerf
2011-03-25 10:12:51 +01:00
committed by Tobias Hunger
parent ac61c9a918
commit cc35cad557

View File

@@ -399,7 +399,9 @@ void VCSBaseClient::view(const QString &source, const QString &id)
VCSBase::VCSBaseEditorWidget *editor = createVCSEditor(kind, title, source,
true, "view", id);
QSharedPointer<VCSJob> job(new VCSJob(QFileInfo(source).absolutePath(), args, editor));
const QFileInfo fi(source);
const QString workingDirPath = fi.isFile() ? fi.absolutePath() : source;
QSharedPointer<VCSJob> job(new VCSJob(workingDirPath, args, editor));
enqueueJob(job);
}