Darwin: normalize all watched paths to composed from
This will be done by all POSIX APIs for strings coming in that way, but because other code (like NSWhateverViews) will most likely return decomposed form, we make sure that those are in composed form too. Task-number: QTBUG-55896 Change-Id: I065e11cee6b59706d4346ed20d4b59b9b95163b8 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
parent
592614ea3e
commit
f6eb570c7d
@ -343,7 +343,7 @@ QStringList QFseventsFileSystemWatcherEngine::addPaths(const QStringList &paths,
|
||||
QStringList p = paths;
|
||||
QMutableListIterator<QString> it(p);
|
||||
while (it.hasNext()) {
|
||||
QString origPath = it.next();
|
||||
QString origPath = it.next().normalized(QString::NormalizationForm_C);
|
||||
QString realPath = origPath;
|
||||
if (realPath.endsWith(QDir::separator()))
|
||||
realPath = realPath.mid(0, realPath.size() - 1);
|
||||
|
@ -78,6 +78,8 @@ private slots:
|
||||
|
||||
void signalsEmittedAfterFileMoved();
|
||||
|
||||
void watchUnicodeCharacters();
|
||||
|
||||
private:
|
||||
QString m_tempDirPattern;
|
||||
#endif // QT_NO_FILESYSTEMWATCHER
|
||||
@ -763,6 +765,25 @@ void tst_QFileSystemWatcher::signalsEmittedAfterFileMoved()
|
||||
QVERIFY2(changedSpy.count() <= fileCount, changedSpy.receivedFilesMessage());
|
||||
QTRY_COMPARE(changedSpy.count(), fileCount);
|
||||
}
|
||||
|
||||
void tst_QFileSystemWatcher::watchUnicodeCharacters()
|
||||
{
|
||||
QTemporaryDir temporaryDirectory(m_tempDirPattern);
|
||||
QVERIFY2(temporaryDirectory.isValid(), qPrintable(temporaryDirectory.errorString()));
|
||||
|
||||
QDir testDir(temporaryDirectory.path());
|
||||
const QString subDir(QString::fromLatin1("caf\xe9"));
|
||||
QVERIFY(testDir.mkdir(subDir));
|
||||
testDir = QDir(temporaryDirectory.path() + QDir::separator() + subDir);
|
||||
|
||||
QFileSystemWatcher watcher;
|
||||
QVERIFY(watcher.addPath(testDir.path()));
|
||||
|
||||
FileSystemWatcherSpy changedSpy(&watcher, FileSystemWatcherSpy::SpyOnDirectoryChanged);
|
||||
QCOMPARE(changedSpy.count(), 0);
|
||||
QVERIFY(testDir.mkdir("creme"));
|
||||
QTRY_COMPARE(changedSpy.count(), 1);
|
||||
}
|
||||
#endif // QT_NO_FILESYSTEMWATCHER
|
||||
|
||||
QTEST_MAIN(tst_QFileSystemWatcher)
|
||||
|
Loading…
Reference in New Issue
Block a user