Handle case sensitive file system gracefully with case-insensitive setup

If you use a case sensitive file system with a Qt Creator that is set to
case insensitive file system handling (default on Windows and macOS),
we still want file change notifications to work as long as you do not
actually have files that only differ in case.

This requires us to carefully differentiate between the keys that are
used for comparing files (=> case insensitive), and the paths that are
registered in the file watcher (=> file path as we get it from the
user).

Also for the check if a file path is a symlink, we should not check
equality of the resolved vs unresolved keys, but equality of the
cleaned, absolute paths (resolved vs unresolved).

Task-number: QTCREATORBUG-17929
Task-number: QTCREATORBUG-18672
Task-number: QTCREATORBUG-18678
Change-Id: I36b8b034880a0c60765a934b3c9e83316c4eb367
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Eike Ziller
2017-08-21 14:46:38 +02:00
parent 4ef01c961e
commit 05485071b0
3 changed files with 117 additions and 80 deletions

View File

@@ -53,7 +53,7 @@ class CORE_EXPORT DocumentManager : public QObject
{
Q_OBJECT
public:
enum FixMode {
enum ResolveMode {
ResolveLinks,
KeepLinks
};
@@ -81,7 +81,8 @@ public:
static void saveSettings();
// helper functions
static QString fixFileName(const QString &fileName, FixMode fixmode);
static QString cleanAbsoluteFilePath(const QString &filePath, ResolveMode resolveMode);
static QString filePathKey(const QString &filePath, ResolveMode resolveMode);
static bool saveDocument(IDocument *document, const QString &fileName = QString(), bool *isReadOnly = 0);