QDoc: Return correct path when quoting example files.
authorCasper van Donderen <casper.vandonderen@nokia.com>
Thu, 10 May 2012 15:35:00 +0000 (17:35 +0200)
committerQt by Nokia <qt-info@nokia.com>
Fri, 11 May 2012 10:52:21 +0000 (12:52 +0200)
When the exampledirs qdocconf variable is . the first 2 characters of
the file to quote from were being cut off, since there was a string
comparison between the size of the strings with and without './'

Change-Id: Iede54b5f77ec8a7530c608908f08e7eb4351f0f1
Reviewed-by: Martin Smith <martin.smith@nokia.com>
src/tools/qdoc/cppcodeparser.cpp

index 3d2cc60..b77d668 100644 (file)
@@ -2509,6 +2509,8 @@ void CppCodeParser::createExampleFileNodes(FakeNode *fake)
     }
 
     int sizeOfBoringPartOfName = fullPath.size() - proFileName.size();
+    if (fullPath.startsWith("./"))
+        sizeOfBoringPartOfName = sizeOfBoringPartOfName - 2;
     fullPath.truncate(fullPath.lastIndexOf('/'));
 
     QStringList exampleFiles = Config::getFilesHere(fullPath,exampleNameFilter);