Commit 14a71bc7 authored by con's avatar con
Browse files

Support symbolic links in the file manager.

We didn't watch the symbolic link itself before, only the final link
target. We are watching the symbolic link and the final link target now.
Ugly hack: We need to work around QTBUG-15522. The inotify and kqueue
based file system watcher engines (Linux + Mac) don't report changes to
symbolic links. The workaround is to use the polling engine *only for
the links themselves*. The only way to force the use of the polling
engine is by using the auto test hook in QFileSystemWatcher.
parent 4b7d826d
...@@ -578,9 +578,9 @@ Core::Internal::EditorView *EditorManager::currentEditorView() const ...@@ -578,9 +578,9 @@ Core::Internal::EditorView *EditorManager::currentEditorView() const
QList<IEditor *> EditorManager::editorsForFileName(const QString &filename) const QList<IEditor *> EditorManager::editorsForFileName(const QString &filename) const
{ {
QList<IEditor *> found; QList<IEditor *> found;
QString fixedname = FileManager::fixFileName(filename); QString fixedname = FileManager::fixFileName(filename, FileManager::KeepLinks);
foreach (IEditor *editor, openedEditors()) { foreach (IEditor *editor, openedEditors()) {
if (fixedname == FileManager::fixFileName(editor->file()->fileName())) if (fixedname == FileManager::fixFileName(editor->file()->fileName(), FileManager::KeepLinks))
found << editor; found << editor;
} }
return found; return found;
This diff is collapsed.
...@@ -53,6 +53,11 @@ class CORE_EXPORT FileManager : public QObject ...@@ -53,6 +53,11 @@ class CORE_EXPORT FileManager : public QObject
{ {
public: public:
enum FixMode {
explicit FileManager(QMainWindow *ew); explicit FileManager(QMainWindow *ew);
virtual ~FileManager(); virtual ~FileManager();
...@@ -80,7 +85,7 @@ public: ...@@ -80,7 +85,7 @@ public:
QString currentFile() const; QString currentFile() const;
// helper methods // helper methods
static QString fixFileName(const QString &fileName); static QString fixFileName(const QString &fileName, FixMode fixmode);
QStringList getOpenFileNames(const QString &filters, QStringList getOpenFileNames(const QString &filters,
const QString path = QString(), const QString path = QString(),
...@@ -134,11 +139,9 @@ private: ...@@ -134,11 +139,9 @@ private:
void readSettings(); void readSettings();
void dump(); void dump();
void addFileInfo(IFile *file); void addFileInfo(IFile *file);
void addFileInfo(const QString &fileName, IFile *file, bool isLink);
void removeFileInfo(IFile *file); void removeFileInfo(IFile *file);
void removeFileInfo(const QString &fileName, IFile *file);
void addWatch(const QString &filename);
void removeWatch(const QString &filename);
void updateFileInfo(IFile *file); void updateFileInfo(IFile *file);
void updateExpectedState(const QString &fileName); void updateExpectedState(const QString &fileName);
...@@ -2262,7 +2262,7 @@ void ProjectExplorerPlugin::renameFile(Node *node, const QString &to) ...@@ -2262,7 +2262,7 @@ void ProjectExplorerPlugin::renameFile(Node *node, const QString &to)
FileNode *fileNode = qobject_cast<FileNode *>(node); FileNode *fileNode = qobject_cast<FileNode *>(node);
if (!fileNode) if (!fileNode)
return; return;
QString orgFilePath = node->path(); QString orgFilePath = QFileInfo(node->path()).absoluteFilePath();
QString dir = QFileInfo(orgFilePath).absolutePath(); QString dir = QFileInfo(orgFilePath).absolutePath();
QString newFilePath = dir + "/" + to; QString newFilePath = dir + "/" + to;
Core::ICore *core = Core::ICore::instance(); Core::ICore *core = Core::ICore::instance();
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment