From: Yuchen Deng Date: Thu, 14 Jun 2012 12:27:02 +0000 (+0800) Subject: MOC: Avoiding MAX_PATH limit on Windows X-Git-Tag: 071012110112~349 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3db8877d286b673bf8a54e7514e8bb70223e4e8a;p=profile%2Fivi%2Fqtbase.git MOC: Avoiding MAX_PATH limit on Windows See: http://msdn.microsoft.com/en-us/library/aa365247(v=VS.85).aspx Task-number: QTBUG-26157 Change-Id: Ie74481cd06c31149a060a432352da5b2731caaef Reviewed-by: Debao Zhang Reviewed-by: Joerg Bornemann --- diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp index 08c180f..7db8737 100644 --- a/src/tools/moc/main.cpp +++ b/src/tools/moc/main.cpp @@ -67,7 +67,15 @@ static QByteArray combinePath(const QByteArray &infile, const QByteArray &outfil { QFileInfo inFileInfo(QDir::current(), QFile::decodeName(infile)); QFileInfo outFileInfo(QDir::current(), QFile::decodeName(outfile)); - return QFile::encodeName(outFileInfo.dir().relativeFilePath(inFileInfo.filePath())); + const QByteArray relativePath = QFile::encodeName(outFileInfo.dir().relativeFilePath(inFileInfo.filePath())); +#ifdef Q_OS_WIN + // It's a system limitation. + // It depends on the Win API function which is used by the program to open files. + // cl apparently uses the functions that have the MAX_PATH limitation. + if (outFileInfo.dir().absolutePath().length() + relativePath.length() + 1 >= 260) + return QFile::encodeName(inFileInfo.absoluteFilePath()); +#endif + return relativePath; }