summaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
authorYuchen Deng <loaden@gmail.com>2012-06-14 20:27:02 +0800
committerQt by Nokia <qt-info@nokia.com>2012-06-20 08:39:41 +0200
commit3db8877d286b673bf8a54e7514e8bb70223e4e8a (patch)
tree9d4218463e97271f4fdb94526a904fb48364a609 /src/tools
parent8b92d770a007739e550a03ccfd8f87601ff97b88 (diff)
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 <dbzhang800@gmail.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/moc/main.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp
index 08c180f44b..7db8737975 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;
}