From 0230852d60dcc187c21e3d6a2bb6a72be993569a Mon Sep 17 00:00:00 2001 From: mlangkabel Date: Tue, 24 Oct 2017 11:56:11 +0200 Subject: [PATCH] logic: fixed handling symbolic links when activating location via IDE (issue #489) --- .../controller/IDECommunicationController.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/lib/component/controller/IDECommunicationController.cpp b/src/lib/component/controller/IDECommunicationController.cpp index 9051a9a9..93e5b085 100644 --- a/src/lib/component/controller/IDECommunicationController.cpp +++ b/src/lib/component/controller/IDECommunicationController.cpp @@ -87,12 +87,14 @@ void IDECommunicationController::handleSetActiveTokenMessage( { const unsigned int cursorColumn = message.column; - if (FileSystem::getFileInfoForPath(FilePath(message.fileLocation)).lastWriteTime - == m_storageAccess->getFileInfoForFilePath(FilePath(message.fileLocation)).lastWriteTime) + const FilePath filePath = FilePath(message.fileLocation).canonical(); + + if (FileSystem::getFileInfoForPath(filePath).lastWriteTime + == m_storageAccess->getFileInfoForFilePath(filePath).lastWriteTime) { // file was not modified std::shared_ptr sourceLocationFile = m_storageAccess->getSourceLocationsForLinesInFile( - FilePath(message.fileLocation), message.row, message.row + filePath, message.row, message.row ); std::vector selectedLocationIds; @@ -113,7 +115,7 @@ void IDECommunicationController::handleSetActiveTokenMessage( if (selectedLocationIds.size() > 0) { - MessageStatus("Activating source location from plug-in succeeded: " + message.fileLocation + ", row: " + + MessageStatus("Activating source location from plug-in succeeded: " + filePath.str() + ", row: " + std::to_string(message.row) + ", col: " + std::to_string(message.column)).dispatch(); MessageActivateSourceLocations(selectedLocationIds).dispatch(); @@ -122,16 +124,16 @@ void IDECommunicationController::handleSetActiveTokenMessage( } } - Id fileId = m_storageAccess->getNodeIdForFileNode(FilePath(message.fileLocation)); + Id fileId = m_storageAccess->getNodeIdForFileNode(filePath); if (fileId > 0) { - MessageActivateFile(FilePath(message.fileLocation), message.row).dispatchImmediately(); + MessageActivateFile(filePath, message.row).dispatchImmediately(); MessageActivateWindow().dispatch(); } else { MessageStatus( - "Activating source location from plug-in failed. File " + message.fileLocation + "Activating source location from plug-in failed. File " + filePath.str() + " was not found in the project.", true ).dispatch();