Commit 14a71bc7 authored by con's avatar con

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
QList<IEditor *> EditorManager::editorsForFileName(const QString &filename) const
{
QList<IEditor *> found;
QString fixedname = FileManager::fixFileName(filename);
QString fixedname = FileManager::fixFileName(filename, FileManager::KeepLinks);
foreach (IEditor *editor, openedEditors()) {
if (fixedname == FileManager::fixFileName(editor->file()->fileName()))
if (fixedname == FileManager::fixFileName(editor->file()->fileName(), FileManager::KeepLinks))
found << editor;
}
return found;
......
This diff is collapsed.
......@@ -53,6 +53,11 @@ class CORE_EXPORT FileManager : public QObject
{
Q_OBJECT
public:
enum FixMode {
ResolveLinks,
KeepLinks
};
explicit FileManager(QMainWindow *ew);
virtual ~FileManager();
......@@ -80,7 +85,7 @@ public:
QString currentFile() const;
// helper methods
static QString fixFileName(const QString &fileName);
static QString fixFileName(const QString &fileName, FixMode fixmode);
QStringList getOpenFileNames(const QString &filters,
const QString path = QString(),
......@@ -134,11 +139,9 @@ private:
void readSettings();
void dump();
void addFileInfo(IFile *file);
void addFileInfo(const QString &fileName, IFile *file, bool isLink);
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 updateExpectedState(const QString &fileName);
......
......@@ -2262,7 +2262,7 @@ void ProjectExplorerPlugin::renameFile(Node *node, const QString &to)
FileNode *fileNode = qobject_cast<FileNode *>(node);
if (!fileNode)
return;
QString orgFilePath = node->path();
QString orgFilePath = QFileInfo(node->path()).absoluteFilePath();
QString dir = QFileInfo(orgFilePath).absolutePath();
QString newFilePath = dir + "/" + to;
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