summaryrefslogtreecommitdiffstats
path: root/src/tools/qdoc/config.cpp
diff options
context:
space:
mode:
authorTopi Reinio <topi.reinio@digia.com>2015-02-17 13:22:53 +0100
committerTopi Reiniƶ <topi.reinio@digia.com>2015-02-27 11:41:05 +0000
commit4fd8513475222ee0afb6f18ec90ba384ffb03bc4 (patch)
tree17769faeed33cfd74b9b444863c27bd5ff59df3b /src/tools/qdoc/config.cpp
parent3146dadb42cb36aff83a62e831b8b4f4dc1562a7 (diff)
qdoc: Improve handling of current working directory
When qdoc reads (potentially nested) documentation files, it sets the current working directory to the path of the currently read file to make relative paths work for include statements and config variables. This works as long as there's only one top-level .qdocconf file. This change fixes problems with handling the CWD to enable relative paths also when we have multiple top-level .qdocconf files, as is the case when running qdoc in single-exec mode. Change-Id: I03a7ec5af93d54070ea29f90ea2ba29c57028781 Reviewed-by: Venugopal Shivashankar <venugopal.shivashankar@digia.com> Reviewed-by: Martin Smith <martin.smith@digia.com>
Diffstat (limited to 'src/tools/qdoc/config.cpp')
-rw-r--r--src/tools/qdoc/config.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/tools/qdoc/config.cpp b/src/tools/qdoc/config.cpp
index 5ab3cb0d7d..e3b2f0325d 100644
--- a/src/tools/qdoc/config.cpp
+++ b/src/tools/qdoc/config.cpp
@@ -912,8 +912,10 @@ QStringList Config::loadMaster(const QString& fileName)
*/
void Config::load(Location location, const QString& fileName)
{
- pushWorkingDir(QFileInfo(fileName).path());
- QDir::setCurrent(QFileInfo(fileName).path());
+ QFileInfo fileInfo(fileName);
+ QString path = fileInfo.canonicalPath();
+ pushWorkingDir(path);
+ QDir::setCurrent(path);
QRegExp keySyntax(QLatin1String("\\w+(?:\\.\\w+)*"));
#define SKIP_CHAR() \
@@ -935,7 +937,7 @@ void Config::load(Location location, const QString& fileName)
if (location.depth() > 16)
location.fatal(tr("Too many nested includes"));
- QFile fin(fileName);
+ QFile fin(fileInfo.fileName());
if (!fin.open(QFile::ReadOnly | QFile::Text)) {
if (!Config::installDir.isEmpty()) {
int prefix = location.filePath().length() - location.fileName().length();
@@ -1030,7 +1032,7 @@ void Config::load(Location location, const QString& fileName)
/*
Here is the recursive call.
*/
- load(location, QFileInfo(QFileInfo(fileName).dir(), includeFile).filePath());
+ load(location, QFileInfo(QDir(path), includeFile).filePath());
}
else {
/*