qdoc: Config class uses current path for each path var
The Config class is further modified to make use of the current directory information it stores with each configuration variable. Task-number: QTBUG-30725 Change-Id: I34c845e6c05d7868266324f1d54e56f94d709f95 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
This commit is contained in:
parent
a2892ad1d7
commit
08be36c176
@ -381,7 +381,7 @@ QStringList Config::getStringList(const QString& var) const
|
||||
\param var The variable containing the list of paths.
|
||||
\see Location::canonicalRelativePath()
|
||||
*/
|
||||
QStringList Config::getCanonicalRelativePathList(const QString& var) const
|
||||
QStringList Config::getCanonicalPathList(const QString& var) const
|
||||
{
|
||||
QStringList t;
|
||||
QList<ConfigVar> configVars = configVars_.values(var);
|
||||
@ -391,15 +391,16 @@ QStringList Config::getCanonicalRelativePathList(const QString& var) const
|
||||
const ConfigVar& cv = configVars[i];
|
||||
if (!cv.location_.isEmpty())
|
||||
(Location&) lastLocation_ = cv.location_;
|
||||
if (!cv.plus_)
|
||||
if (!cv.plus_) {
|
||||
t.clear();
|
||||
}
|
||||
const QString d = cv.currentPath_;
|
||||
const QStringList& sl = cv.values_;
|
||||
if (!sl.isEmpty()) {
|
||||
t.reserve(t.size() + sl.size());
|
||||
for (int i=0; i<sl.size(); ++i) {
|
||||
const QString& crp = Location::canonicalRelativePath(sl[i], d);
|
||||
t.append(crp);
|
||||
QDir dir(d + "/" + sl[i]);
|
||||
t.append(dir.canonicalPath());
|
||||
}
|
||||
}
|
||||
--i;
|
||||
@ -595,7 +596,7 @@ QStringList Config::getAllFiles(const QString &filesVar,
|
||||
const QSet<QString> &excludedFiles)
|
||||
{
|
||||
QStringList result = getStringList(filesVar);
|
||||
QStringList dirs = getCanonicalRelativePathList(dirsVar);
|
||||
QStringList dirs = getCanonicalPathList(dirsVar);
|
||||
|
||||
QString nameFilter = getString(filesVar + dot + QLatin1String(CONFIG_FILEEXTENSIONS));
|
||||
|
||||
@ -611,7 +612,7 @@ QStringList Config::getExampleQdocFiles(const QSet<QString> &excludedDirs,
|
||||
const QSet<QString> &excludedFiles)
|
||||
{
|
||||
QStringList result;
|
||||
QStringList dirs = getCanonicalRelativePathList("exampledirs");
|
||||
QStringList dirs = getCanonicalPathList("exampledirs");
|
||||
QString nameFilter = " *.qdoc";
|
||||
|
||||
QStringList::ConstIterator d = dirs.constBegin();
|
||||
@ -626,7 +627,7 @@ QStringList Config::getExampleImageFiles(const QSet<QString> &excludedDirs,
|
||||
const QSet<QString> &excludedFiles)
|
||||
{
|
||||
QStringList result;
|
||||
QStringList dirs = getCanonicalRelativePathList("exampledirs");
|
||||
QStringList dirs = getCanonicalPathList("exampledirs");
|
||||
QString nameFilter = getString(CONFIG_EXAMPLES + dot + QLatin1String(CONFIG_IMAGEEXTENSIONS));
|
||||
|
||||
QStringList::ConstIterator d = dirs.constBegin();
|
||||
|
@ -101,7 +101,7 @@ public:
|
||||
QString getString(const QString& var) const;
|
||||
QSet<QString> getStringSet(const QString& var) const;
|
||||
QStringList getStringList(const QString& var) const;
|
||||
QStringList getCanonicalRelativePathList(const QString& var) const;
|
||||
QStringList getCanonicalPathList(const QString& var) const;
|
||||
QStringList getCleanPathList(const QString& var) const;
|
||||
QStringList getPathList(const QString& var) const;
|
||||
QRegExp getRegExp(const QString& var) const;
|
||||
|
@ -243,21 +243,6 @@ QString Location::canonicalRelativePath(const QString &path)
|
||||
return configFileDir.relativeFilePath(canon);
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Returns \a path which is canonicalized and relative to the \a configDir.
|
||||
|
||||
QDir::relativeFilePath does not canonicalize the paths, so
|
||||
if the config file is located at qtbase\src\widgets\doc\qtwidgets.qdocconf
|
||||
and it has a reference to any ancestor folder (e.g. ".." or even "../doc")
|
||||
*/
|
||||
QString Location::canonicalRelativePath(const QString &path, const QString &configDir)
|
||||
{
|
||||
QDir configFileDir(configDir);
|
||||
QDir dir(path);
|
||||
const QString canon = dir.canonicalPath();
|
||||
return configFileDir.relativeFilePath(canon);
|
||||
}
|
||||
|
||||
/*! \fn int Location::lineNo() const
|
||||
Returns the current line number.
|
||||
Must not be called on an empty Location object.
|
||||
|
@ -101,7 +101,6 @@ public:
|
||||
static void startLoggingProgress() { logProgress_ = true; }
|
||||
static void stopLoggingProgress() { logProgress_ = false; }
|
||||
static QString canonicalRelativePath(const QString &path);
|
||||
static QString canonicalRelativePath(const QString &path, const QString &configDir);
|
||||
|
||||
private:
|
||||
enum MessageType { Warning, Error };
|
||||
|
@ -356,7 +356,7 @@ static void processQdocconfFile(const QString &fileName)
|
||||
QStringList excludedFilesList;
|
||||
|
||||
Generator::debugSegfault("Reading excludedirs");
|
||||
excludedDirsList = config.getCanonicalRelativePathList(CONFIG_EXCLUDEDIRS);
|
||||
excludedDirsList = config.getCanonicalPathList(CONFIG_EXCLUDEDIRS);
|
||||
foreach (const QString &excludeDir, excludedDirsList) {
|
||||
QString p = QDir::fromNativeSeparators(excludeDir);
|
||||
QDir tmp(p);
|
||||
|
Loading…
Reference in New Issue
Block a user