Fix parsing of filename with position when -client is used

Instead of transforming to absolute paths in the client, pass the
working directory and leave it to the target.

Change-Id: I4f8724c8857e89a7ee77116c78cf8b25c56795fa
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
Orgad Shaneh
2015-03-09 10:59:58 +02:00
committed by Orgad Shaneh
parent facc89fafd
commit 17f2af5082
8 changed files with 43 additions and 25 deletions

View File

@@ -761,18 +761,24 @@ static IDocumentFactory *findDocumentFactory(const QList<IDocumentFactory*> &fil
* \a flags can be used to stop on first failure, indicate that a file name
* might include line numbers and/or switch mode to edit mode.
*
* \a workingDirectory is used when files are opened by a remote client, since
* the file names are relative to the client working directory.
*
* \returns the first opened document. Required to support the -block flag
* for client mode.
*
* \sa IPlugin::remoteArguments()
*/
IDocument *MainWindow::openFiles(const QStringList &fileNames, ICore::OpenFilesFlags flags)
IDocument *MainWindow::openFiles(const QStringList &fileNames,
ICore::OpenFilesFlags flags,
const QString &workingDirectory)
{
QList<IDocumentFactory*> documentFactories = PluginManager::getObjects<IDocumentFactory>();
IDocument *res = 0;
foreach (const QString &fileName, fileNames) {
const QFileInfo fi(fileName);
const QDir workingDir(workingDirectory.isEmpty() ? QDir::currentPath() : workingDirectory);
const QFileInfo fi(workingDir, fileName);
const QString absoluteFilePath = fi.absoluteFilePath();
if (IDocumentFactory *documentFactory = findDocumentFactory(documentFactories, fi)) {
IDocument *document = documentFactory->open(absoluteFilePath);