diff --git a/src/lib/LicenseChecker.cpp b/src/lib/LicenseChecker.cpp index b4493b27..da3fc5c9 100644 --- a/src/lib/LicenseChecker.cpp +++ b/src/lib/LicenseChecker.cpp @@ -83,7 +83,7 @@ LicenseChecker::LicenseState LicenseChecker::checkCurrentLicense() const return LICENSE_EMPTY; } - if (!License::checkLocation(FilePath(appPath).absolute().str(), licenseCheck)) + if (!License::checkLocation(FilePath(appPath).makeAbsolute().str(), licenseCheck)) { return LICENSE_MOVED; } diff --git a/src/lib/component/controller/IDECommunicationController.cpp b/src/lib/component/controller/IDECommunicationController.cpp index 8b37c5bf..ed1c7b57 100644 --- a/src/lib/component/controller/IDECommunicationController.cpp +++ b/src/lib/component/controller/IDECommunicationController.cpp @@ -87,7 +87,7 @@ void IDECommunicationController::handleSetActiveTokenMessage( { const unsigned int cursorColumn = message.column; - const FilePath filePath = FilePath(message.fileLocation).canonical(); + const FilePath filePath = FilePath(message.fileLocation).makeCanonical(); if (FileSystem::getFileInfoForPath(filePath).lastWriteTime == m_storageAccess->getFileInfoForFilePath(filePath).lastWriteTime) diff --git a/src/lib/component/view/GraphViewStyle.cpp b/src/lib/component/view/GraphViewStyle.cpp index d671b6ab..91b30ad5 100644 --- a/src/lib/component/view/GraphViewStyle.cpp +++ b/src/lib/component/view/GraphViewStyle.cpp @@ -486,7 +486,7 @@ GraphViewStyle::NodeStyle GraphViewStyle::getStyleOfBundleNode(bool isFocused) return getStyleForNodeType( NodeType::STYLE_BIG_NODE, "bundle", - ResourcePaths::getGuiPath().concat(FilePath("graph_view/images/bundle.png")), + ResourcePaths::getGuiPath().concatenate(FilePath("graph_view/images/bundle.png")), true, false, isFocused, diff --git a/src/lib/data/NodeType.cpp b/src/lib/data/NodeType.cpp index d58c27b4..90beb678 100644 --- a/src/lib/data/NodeType.cpp +++ b/src/lib/data/NodeType.cpp @@ -228,19 +228,19 @@ FilePath NodeType::getIconPath() const if (isPackage()) { // this icon cannot be changed - return ResourcePaths::getGuiPath().concat(FilePath("graph_view/images/namespace.png")); + return ResourcePaths::getGuiPath().concatenate(FilePath("graph_view/images/namespace.png")); } switch (m_type) { case NodeType::NODE_ENUM: - return ResourcePaths::getGuiPath().concat(FilePath("graph_view/images/enum.png")); + return ResourcePaths::getGuiPath().concatenate(FilePath("graph_view/images/enum.png")); case NodeType::NODE_TYPEDEF: - return ResourcePaths::getGuiPath().concat(FilePath("graph_view/images/typedef.png")); + return ResourcePaths::getGuiPath().concatenate(FilePath("graph_view/images/typedef.png")); case NodeType::NODE_MACRO: - return ResourcePaths::getGuiPath().concat(FilePath("graph_view/images/macro.png")); + return ResourcePaths::getGuiPath().concatenate(FilePath("graph_view/images/macro.png")); case NodeType::NODE_FILE: - return ResourcePaths::getGuiPath().concat(FilePath("graph_view/images/file.png")); + return ResourcePaths::getGuiPath().concatenate(FilePath("graph_view/images/file.png")); default: return FilePath(); } diff --git a/src/lib/data/NodeType.h b/src/lib/data/NodeType.h index 7fecb2a8..5efe9f97 100644 --- a/src/lib/data/NodeType.h +++ b/src/lib/data/NodeType.h @@ -1,6 +1,7 @@ #ifndef NODE_TYPE_H #define NODE_TYPE_H +#include #include #include #include diff --git a/src/lib/data/parser/ParseLocation.cpp b/src/lib/data/parser/ParseLocation.cpp index 52f43399..972e89a1 100644 --- a/src/lib/data/parser/ParseLocation.cpp +++ b/src/lib/data/parser/ParseLocation.cpp @@ -14,16 +14,12 @@ ParseLocation::ParseLocation( uint lineNumber, uint columnNumber ) - : filePath(filePath) + : filePath(filePath.getCanonical()) , startLineNumber(lineNumber) , startColumnNumber(columnNumber) , endLineNumber(lineNumber) , endColumnNumber(columnNumber) { - if (this->filePath.exists()) - { - this->filePath = this->filePath.canonical(); - } } ParseLocation::ParseLocation( @@ -31,16 +27,12 @@ ParseLocation::ParseLocation( uint startLineNumber, uint startColumnNumber, uint endLineNumber, uint endColumnNumber ) - : filePath(filePath) + : filePath(filePath.getCanonical()) , startLineNumber(startLineNumber) , startColumnNumber(startColumnNumber) , endLineNumber(endLineNumber) , endColumnNumber(endColumnNumber) { - if (this->filePath.exists()) - { - this->filePath = this->filePath.canonical(); - } } bool ParseLocation::isValid() const diff --git a/src/lib/data/storage/PersistentStorage.cpp b/src/lib/data/storage/PersistentStorage.cpp index 372417c8..819be6e3 100644 --- a/src/lib/data/storage/PersistentStorage.cpp +++ b/src/lib/data/storage/PersistentStorage.cpp @@ -75,7 +75,7 @@ void PersistentStorage::addSymbol(const StorageSymbol& data) void PersistentStorage::addFile(const StorageFile& data) { - StorageFile storedFile = m_sqliteIndexStorage.getFirstById(data.id); + const StorageFile storedFile = m_sqliteIndexStorage.getFirstById(data.id); if (storedFile.id == 0) { @@ -90,7 +90,7 @@ void PersistentStorage::addFile(const StorageFile& data) Id PersistentStorage::addEdge(const StorageEdgeData& data) { - StorageEdge storedEdge = m_sqliteIndexStorage.getEdgeBySourceTargetType(data.sourceNodeId, data.targetNodeId, data.type); + const StorageEdge storedEdge = m_sqliteIndexStorage.getEdgeBySourceTargetType(data.sourceNodeId, data.targetNodeId, data.type); if (storedEdge.id == 0) { return m_sqliteIndexStorage.addEdge(data).id; @@ -100,7 +100,7 @@ Id PersistentStorage::addEdge(const StorageEdgeData& data) Id PersistentStorage::addLocalSymbol(const StorageLocalSymbolData& data) { - StorageLocalSymbol storedLocalSymbol = m_sqliteIndexStorage.getLocalSymbolByName(data.name); + const StorageLocalSymbol storedLocalSymbol = m_sqliteIndexStorage.getLocalSymbolByName(data.name); if (storedLocalSymbol.id == 0) { return m_sqliteIndexStorage.addLocalSymbol(data).id; @@ -451,8 +451,8 @@ Id PersistentStorage::getIdForEdge( Edge::EdgeType type, const NameHierarchy& fromNameHierarchy, const NameHierarchy& toNameHierarchy ) const { - Id sourceId = getNodeIdForNameHierarchy(fromNameHierarchy); - Id targetId = getNodeIdForNameHierarchy(toNameHierarchy); + const Id sourceId = getNodeIdForNameHierarchy(fromNameHierarchy); + const Id targetId = getNodeIdForNameHierarchy(toNameHierarchy); return m_sqliteIndexStorage.getEdgeBySourceTargetType(sourceId, targetId, type).id; } @@ -484,12 +484,11 @@ std::shared_ptr PersistentStorage::getFullTextSearchLo false, true ).dispatch(); - std::vector allHits = m_fullTextSearchIndex.searchForTerm(searchTerm); - int termLength = searchTerm.length(); + const int termLength = searchTerm.length(); - for (FullTextSearchResult fileHits : allHits) + for (const FullTextSearchResult& fileHits : m_fullTextSearchIndex.searchForTerm(searchTerm)) { - FilePath filePath = getFileNodePath(fileHits.fileId); + const FilePath filePath = getFileNodePath(fileHits.fileId); std::shared_ptr fileContent = getFileContent(filePath); int charsTotal = 0; @@ -525,7 +524,7 @@ std::shared_ptr PersistentStorage::getFullTextSearchLo location.endColumnNumber = pos + termLength - charsTotal; // Set first bit to 1 to avoid collisions - Id locationId = ~(~Id(0) >> 1) + collection->getSourceLocationCount() + 1; + const Id locationId = ~(~Id(0) >> 1) + collection->getSourceLocationCount() + 1; collection->addSourceLocation( LOCATION_FULLTEXT_SEARCH, @@ -557,8 +556,8 @@ std::vector PersistentStorage::getAutocompletionMatches(const std:: TRACE(); // search in indices - size_t maxResultsCount = 100; - size_t maxBestScoredResultsLength = 100; + const size_t maxResultsCount = 100; + const size_t maxBestScoredResultsLength = 100; // create SearchMatches std::vector matches; @@ -603,7 +602,7 @@ std::vector PersistentStorage::getAutocompletionSymbolMatches( const std::string& query, const NodeTypeSet& acceptedNodeTypes, size_t maxResultsCount, size_t maxBestScoredResultsLength) const { // search in indices - std::vector results = + const std::vector results = m_symbolIndex.search(query, acceptedNodeTypes, maxResultsCount, maxBestScoredResultsLength); // fetch StorageNodes for node ids @@ -685,7 +684,7 @@ std::vector PersistentStorage::getAutocompletionSymbolMatches( std::vector PersistentStorage::getAutocompletionFileMatches(const std::string& query, size_t maxResultsCount) const { - std::vector results = m_fileIndex.search( + const std::vector results = m_fileIndex.search( query, NodeTypeSet::all().getWithMatchingKept([](const NodeType& type) { return type.isFile(); }), maxResultsCount, @@ -701,7 +700,7 @@ std::vector PersistentStorage::getAutocompletionFileMatches(const s match.name = result.text; match.tokenIds = utility::toVector(result.elementIds); - FilePath path(match.name); + const FilePath path(match.name); match.text = path.fileName(); match.subtext = path.str(); @@ -725,7 +724,7 @@ std::vector PersistentStorage::getAutocompletionCommandMatches( const std::string& query, NodeTypeSet acceptedNodeTypes) const { // search in indices - std::vector results = m_commandIndex.search(query, NodeTypeSet::all(), 0); + const std::vector results = m_commandIndex.search(query, NodeTypeSet::all(), 0); // create SearchMatches std::vector matches; @@ -785,7 +784,7 @@ std::vector PersistentStorage::getSearchMatchesForTokenIds(const st StorageNode node = storageNodeMap[elementId]; SearchMatch match; - NameHierarchy nameHierarchy = NameHierarchy::deserialize(node.serializedName); + const NameHierarchy nameHierarchy = NameHierarchy::deserialize(node.serializedName); match.name = nameHierarchy.getQualifiedName(); match.text = nameHierarchy.getRawName(); @@ -885,11 +884,11 @@ std::shared_ptr PersistentStorage::getGraphForActiveTokenIds( if (tokenIds.size() == 1) { const Id elementId = tokenIds[0]; - StorageNode node = m_sqliteIndexStorage.getFirstById(elementId); + const StorageNode node = m_sqliteIndexStorage.getFirstById(elementId); if (node.id > 0) { - NodeType nodeType = utility::intToType(node.type); + const NodeType nodeType = utility::intToType(node.type); if (nodeType.isPackage()) { ids.clear(); @@ -911,8 +910,7 @@ std::shared_ptr PersistentStorage::getGraphForActiveTokenIds( nodeIds.push_back(elementId); edgeIds.clear(); - std::vector edges = m_sqliteIndexStorage.getEdgesBySourceOrTargetId(elementId); - for (const StorageEdge& edge : edges) + for (const StorageEdge& edge : m_sqliteIndexStorage.getEdgesBySourceOrTargetId(elementId)) { Edge::EdgeType edgeType = Edge::intToType(edge.type); if (edgeType == Edge::EDGE_MEMBER) @@ -965,8 +963,7 @@ std::shared_ptr PersistentStorage::getGraphForActiveTokenIds( { if (nodeIds.size() != ids.size()) { - std::vector edges = m_sqliteIndexStorage.getAllByIds(ids); - for (const StorageEdge& edge : edges) + for (const StorageEdge& edge : m_sqliteIndexStorage.getAllByIds(ids)) { if (edge.id > 0) { @@ -1082,8 +1079,8 @@ std::shared_ptr PersistentStorage::getGraphForTrail( { bool isForward = forward == !(Edge::intToType(edge.type) & (Edge::EDGE_OVERRIDE | Edge::EDGE_INHERITANCE)); - Id nodeId = isForward ? edge.targetNodeId : edge.sourceNodeId; - Id otherNodeId = isForward ? edge.sourceNodeId : edge.targetNodeId; + const Id nodeId = isForward ? edge.targetNodeId : edge.sourceNodeId; + const Id otherNodeId = isForward ? edge.sourceNodeId : edge.targetNodeId; if (nodeIds.find(nodeId) == nodeIds.end()) { @@ -1127,7 +1124,7 @@ std::vector PersistentStorage::getActiveTokenIdsForId(Id tokenId, Id* declar { *declarationId = tokenId; - std::vector incomingEdges = m_sqliteIndexStorage.getEdgesByTargetId(tokenId); + const std::vector incomingEdges = m_sqliteIndexStorage.getEdgesByTargetId(tokenId); for (size_t i = 0; i < incomingEdges.size(); i++) { activeTokenIds.push_back(incomingEdges[i].id); @@ -1150,7 +1147,7 @@ std::vector PersistentStorage::getNodeIdsForLocationIds(const std::vector(elementId); + const StorageEdge edge = m_sqliteIndexStorage.getFirstById(elementId); if (edge.id != 0) { auto it = m_symbolDefinitionKinds.find(edge.targetNodeId); @@ -1210,7 +1207,7 @@ std::shared_ptr PersistentStorage::getSourceLocationsF // check for non-indexed file if (path.empty() && m_symbolDefinitionKinds.find(tokenId) == m_symbolDefinitionKinds.end()) { - StorageNode fileNode = m_sqliteIndexStorage.getNodeById(tokenId); + const StorageNode fileNode = m_sqliteIndexStorage.getNodeById(tokenId); if (NodeType(utility::intToType(fileNode.type)).isFile()) { path = FilePath(NameHierarchy::deserialize(fileNode.serializedName).getQualifiedName()); @@ -1248,7 +1245,7 @@ std::shared_ptr PersistentStorage::getSourceLocationsF auto it = locationIdToElementIdMap.find(sourceLocation.id); if (it != locationIdToElementIdMap.end()) { - LocationType type = intToLocationType(sourceLocation.type); + const LocationType type = intToLocationType(sourceLocation.type); if (type == LOCATION_QUALIFIER) { continue; @@ -1257,10 +1254,10 @@ std::shared_ptr PersistentStorage::getSourceLocationsF FilePath path = getFileNodePath(sourceLocation.fileNodeId); if (path.empty()) { - StorageNode fileNode = m_sqliteIndexStorage.getNodeById(sourceLocation.fileNodeId); + const StorageNode fileNode = m_sqliteIndexStorage.getNodeById(sourceLocation.fileNodeId); if (fileNode.id) { - FilePath path2 = FilePath(NameHierarchy::deserialize(fileNode.serializedName).getQualifiedName()); + const FilePath path2 = FilePath(NameHierarchy::deserialize(fileNode.serializedName).getQualifiedName()); if (path2.exists()) { path = path2; @@ -1343,9 +1340,9 @@ std::shared_ptr PersistentStorage::getCommentLocationsInFile { TRACE(); - std::shared_ptr file = std::make_shared(filePath, false, false); + const std::shared_ptr file = std::make_shared(filePath, false, false); - std::vector storageLocations = m_sqliteIndexStorage.getCommentLocationsInFile(filePath); + const std::vector storageLocations = m_sqliteIndexStorage.getCommentLocationsInFile(filePath); for (size_t i = 0; i < storageLocations.size(); i++) { file->addSourceLocation( @@ -1378,8 +1375,7 @@ std::vector PersistentStorage::getFileInfosForFilePaths(const std::vec { std::vector fileInfos; - std::vector storageFiles = m_sqliteIndexStorage.getFilesByPaths(filePaths); - for (const StorageFile& file : storageFiles) + for (const StorageFile& file : m_sqliteIndexStorage.getFilesByPaths(filePaths)) { fileInfos.push_back(FileInfo(FilePath(file.filePath), file.modificationTime)); } @@ -1692,7 +1688,7 @@ TooltipInfo PersistentStorage::getTooltipInfoForTokenIds(const std::vector& StorageNode node = m_sqliteIndexStorage.getFirstById(tokenIds[0]); if (node.id == 0 && origin == TOOLTIP_ORIGIN_CODE) { - StorageEdge edge = m_sqliteIndexStorage.getFirstById(tokenIds[0]); + const StorageEdge edge = m_sqliteIndexStorage.getFirstById(tokenIds[0]); if (edge.id > 0) { @@ -1705,11 +1701,11 @@ TooltipInfo PersistentStorage::getTooltipInfoForTokenIds(const std::vector& return info; } - NodeType type = utility::intToType(node.type); + const NodeType type = utility::intToType(node.type); info.title = type.getReadableTypeString(); DefinitionKind defKind = DEFINITION_NONE; - StorageSymbol symbol = m_sqliteIndexStorage.getFirstById(node.id); + const StorageSymbol symbol = m_sqliteIndexStorage.getFirstById(node.id); if (symbol.id > 0) { defKind = intToDefinitionKind(symbol.definitionKind); @@ -1717,7 +1713,7 @@ TooltipInfo PersistentStorage::getTooltipInfoForTokenIds(const std::vector& if (type.isPotentialMember()) { - StorageComponentAccess access = m_sqliteIndexStorage.getComponentAccessByNodeId(node.id); + const StorageComponentAccess access = m_sqliteIndexStorage.getComponentAccessByNodeId(node.id); if (access.nodeId != 0) { info.title = accessKindToString(intToAccessKind(access.type)) + " " + info.title; @@ -1768,8 +1764,8 @@ TooltipSnippet PersistentStorage::getTooltipSnippetForNode(const StorageNode& no { TRACE(); + const NameHierarchy nameHierarchy = NameHierarchy::deserialize(node.serializedName); TooltipSnippet snippet; - NameHierarchy nameHierarchy = NameHierarchy::deserialize(node.serializedName); snippet.code = nameHierarchy.getQualifiedNameWithSignature(); snippet.locationFile = std::make_shared( FilePath(nameHierarchy.getDelimiter() == NAME_DELIMITER_JAVA ? "main.java" : "main.cpp"), true, true); @@ -2093,7 +2089,7 @@ std::set PersistentStorage::getReferencing( std::set PersistentStorage::getReferencedByIncludes(const std::set& filePaths) { - std::set ids = getReferenced(getFileNodeIds(filePaths), getFileIdToIncludingFileIdMap()); + const std::set ids = getReferenced(getFileNodeIds(filePaths), getFileIdToIncludingFileIdMap()); std::set paths; for (Id id: ids) @@ -2106,7 +2102,7 @@ std::set PersistentStorage::getReferencedByIncludes(const std::set PersistentStorage::getReferencedByImports(const std::set& filePaths) { - std::set ids = getReferenced(getFileNodeIds(filePaths), getFileIdToImportingFileIdMap()); + const std::set ids = getReferenced(getFileNodeIds(filePaths), getFileIdToImportingFileIdMap()); std::set paths; for (Id id: ids) @@ -2119,7 +2115,7 @@ std::set PersistentStorage::getReferencedByImports(const std::set PersistentStorage::getReferencingByIncludes(const std::set& filePaths) { - std::set ids = getReferencing(getFileNodeIds(filePaths), getFileIdToIncludingFileIdMap()); + const std::set ids = getReferencing(getFileNodeIds(filePaths), getFileIdToIncludingFileIdMap()); std::set paths; for (Id id: ids) @@ -2132,7 +2128,7 @@ std::set PersistentStorage::getReferencingByIncludes(const std::set PersistentStorage::getReferencingByImports(const std::set& filePaths) { - std::set ids = getReferencing(getFileNodeIds(filePaths), getFileIdToImportingFileIdMap()); + const std::set ids = getReferencing(getFileNodeIds(filePaths), getFileIdToImportingFileIdMap()); std::set paths; for (Id id: ids) @@ -2316,7 +2312,7 @@ void PersistentStorage::addAggregationEdgesToGraph( // get all children of the active node std::set childNodeIdsSet, edgeIdsSet; m_hierarchyCache.addAllChildIdsForNodeId(nodeId, &childNodeIdsSet, &edgeIdsSet); - std::vector childNodeIds = utility::toVector(childNodeIdsSet); + const std::vector childNodeIds = utility::toVector(childNodeIdsSet); if (childNodeIds.size() == 0 && edgesToAggregate.size() == 0) { return; @@ -2333,7 +2329,7 @@ void PersistentStorage::addAggregationEdgesToGraph( connectedNodeIds[isSource ? edge.targetNodeId : edge.sourceNodeId].push_back(edgeInfo); } - std::vector outgoingEdges = m_sqliteIndexStorage.getEdgesBySourceIds(childNodeIds); + const std::vector outgoingEdges = m_sqliteIndexStorage.getEdgesBySourceIds(childNodeIds); for (const StorageEdge& outEdge : outgoingEdges) { EdgeInfo edgeInfo; @@ -2342,7 +2338,7 @@ void PersistentStorage::addAggregationEdgesToGraph( connectedNodeIds[outEdge.targetNodeId].push_back(edgeInfo); } - std::vector incomingEdges = m_sqliteIndexStorage.getEdgesByTargetIds(childNodeIds); + const std::vector incomingEdges = m_sqliteIndexStorage.getEdgesByTargetIds(childNodeIds); for (const StorageEdge& inEdge : incomingEdges) { EdgeInfo edgeInfo; @@ -2352,12 +2348,12 @@ void PersistentStorage::addAggregationEdgesToGraph( } // get all parent nodes of all connected nodes (up to last level except namespace/undefined) - Id nodeParentNodeId = m_hierarchyCache.getLastVisibleParentNodeId(nodeId); + const Id nodeParentNodeId = m_hierarchyCache.getLastVisibleParentNodeId(nodeId); std::map> connectedParentNodeIds; for (const std::pair>& p : connectedNodeIds) { - Id parentNodeId = m_hierarchyCache.getLastVisibleParentNodeId(p.first); + const Id parentNodeId = m_hierarchyCache.getLastVisibleParentNodeId(p.first); if (parentNodeId != nodeParentNodeId) { @@ -2396,7 +2392,7 @@ void PersistentStorage::addAggregationEdgesToGraph( } // Set first bit to 1 to avoid collisions - Id aggregationId = ~(~Id(0) >> 1) + *componentAggregation->getAggregationIds().begin(); + const Id aggregationId = ~(~Id(0) >> 1) + *componentAggregation->getAggregationIds().begin(); Edge* edge = graph->createEdge(aggregationId, Edge::EDGE_AGGREGATION, sourceNode, targetNode); edge->addComponentAggregation(componentAggregation); @@ -2483,9 +2479,9 @@ void PersistentStorage::addInheritanceChainsToGraph(const std::vector& activ for (const std::tuple>& edge : m_hierarchyCache.getInheritanceEdgesForNodeId(nodeId, *nodeIdSets[(i + 1) % 2])) { - Id sourceId = std::get<0>(edge); - Id targetId = std::get<1>(edge); - std::vector edgeIds = std::get<2>(edge); + const Id sourceId = std::get<0>(edge); + const Id targetId = std::get<1>(edge); + const std::vector edgeIds = std::get<2>(edge); if (!edgeIds.size() || (edgeIds.size() == 1 && graph->getEdgeById(edgeIds[0]))) { @@ -2493,7 +2489,7 @@ void PersistentStorage::addInheritanceChainsToGraph(const std::vector& activ } // Set first 2 bits to 1 to avoid collisions - Id inheritanceEdgeId = ~(~Id(0) >> 2) + inheritanceEdgeCount++; + const Id inheritanceEdgeId = ~(~Id(0) >> 2) + inheritanceEdgeCount++; Edge* inheritanceEdge = graph->createEdge( inheritanceEdgeId, Edge::EDGE_INHERITANCE, graph->getNodeById(sourceId), graph->getNodeById(targetId)); @@ -2510,7 +2506,7 @@ void PersistentStorage::buildFilePathMaps() for (StorageFile& file: m_sqliteIndexStorage.getAll()) { - FilePath path = FilePath(file.filePath); + const FilePath path(file.filePath); m_fileNodeIds.emplace(path, file.id); m_fileNodePaths.emplace(file.id, path); @@ -2532,7 +2528,7 @@ void PersistentStorage::buildSearchIndex() { TRACE(); - FilePath dbPath = getDbFilePath(); + const FilePath dbPath = getDbFilePath(); for (StorageNode& node : m_sqliteIndexStorage.getAll()) { @@ -2546,7 +2542,7 @@ void PersistentStorage::buildSearchIndex() if (filePath.exists()) { - filePath = filePath.relativeTo(dbPath); + filePath.makeRelativeTo(dbPath); } m_fileIndex.addNode(node.id, filePath.str(), type); @@ -2555,10 +2551,10 @@ void PersistentStorage::buildSearchIndex() else { auto it = m_symbolDefinitionKinds.find(node.id); - DefinitionKind defKind = (it != m_symbolDefinitionKinds.end() ? it->second : DEFINITION_NONE); + const DefinitionKind defKind = (it != m_symbolDefinitionKinds.end() ? it->second : DEFINITION_NONE); if (defKind != DEFINITION_IMPLICIT) { - NameHierarchy nameHierarchy = NameHierarchy::deserialize(node.serializedName); + const NameHierarchy nameHierarchy = NameHierarchy::deserialize(node.serializedName); // we don't use the signature here, so elements with the same signature share the same node. std::string name = nameHierarchy.getQualifiedName(); @@ -2618,13 +2614,13 @@ void PersistentStorage::buildMemberEdgeIdOrderMap() SourceLocationCollection collection; for (const StorageSourceLocation& location: m_sqliteIndexStorage.getAllByIds(locationIds)) { - LocationType locType = intToLocationType(location.type); + const LocationType locType = intToLocationType(location.type); if (locType != LOCATION_TOKEN) { continue; } - FilePath path(m_fileNodePaths[location.fileNodeId]); + const FilePath path(m_fileNodePaths[location.fileNodeId]); if (path.extension() == ".java") { collection.addSourceLocation( @@ -2666,7 +2662,7 @@ void PersistentStorage::buildHierarchyCache() { TRACE(); - std::vector memberEdges = m_sqliteIndexStorage.getEdgesByType(Edge::typeToInt(Edge::EDGE_MEMBER)); + const std::vector memberEdges = m_sqliteIndexStorage.getEdgesByType(Edge::typeToInt(Edge::EDGE_MEMBER)); std::vector sourceNodeIds; for (const StorageEdge& edge : memberEdges) @@ -2674,10 +2670,8 @@ void PersistentStorage::buildHierarchyCache() sourceNodeIds.push_back(edge.sourceNodeId); } - std::vector sourceNodes = m_sqliteIndexStorage.getAllByIds(sourceNodeIds); - std::map sourceNodeTypeMap; - for (const StorageNode& node : sourceNodes) + for (const StorageNode& node : m_sqliteIndexStorage.getAllByIds(sourceNodeIds)) { sourceNodeTypeMap.emplace(node.id, utility::intToType(node.type)); } diff --git a/src/lib/data/storage/sqlite/SqliteIndexStorage.cpp b/src/lib/data/storage/sqlite/SqliteIndexStorage.cpp index 7a3ce3c1..dc2290fa 100644 --- a/src/lib/data/storage/sqlite/SqliteIndexStorage.cpp +++ b/src/lib/data/storage/sqlite/SqliteIndexStorage.cpp @@ -8,7 +8,7 @@ const size_t SqliteIndexStorage::s_storageVersion = 15; SqliteIndexStorage::SqliteIndexStorage(const FilePath& dbFilePath) - : SqliteStorage(dbFilePath.canonical()) + : SqliteStorage(dbFilePath.getCanonical()) { } diff --git a/src/lib/data/storage/sqlite/SqliteStorage.cpp b/src/lib/data/storage/sqlite/SqliteStorage.cpp index f1565bdb..067bb658 100644 --- a/src/lib/data/storage/sqlite/SqliteStorage.cpp +++ b/src/lib/data/storage/sqlite/SqliteStorage.cpp @@ -4,7 +4,7 @@ #include "utility/TimeStamp.h" SqliteStorage::SqliteStorage(const FilePath& dbFilePath) - : m_dbFilePath(dbFilePath.canonical()) + : m_dbFilePath(dbFilePath.getCanonical()) { m_database.open(m_dbFilePath.str().c_str()); diff --git a/src/lib/settings/ApplicationSettings.cpp b/src/lib/settings/ApplicationSettings.cpp index 6d0162ef..4e18372d 100644 --- a/src/lib/settings/ApplicationSettings.cpp +++ b/src/lib/settings/ApplicationSettings.cpp @@ -149,7 +149,7 @@ void ApplicationSettings::setShowBuiltinTypesInGraph(bool showBuiltinTypes) FilePath ApplicationSettings::getColorSchemePath() const { - FilePath defaultPath(ResourcePaths::getColorSchemesPath().concat(FilePath("bright.xml"))); + FilePath defaultPath(ResourcePaths::getColorSchemesPath().concatenate(FilePath("bright.xml"))); FilePath path(getValue("application/color_scheme", defaultPath.str())); if (path != defaultPath && !path.exists()) @@ -423,7 +423,7 @@ std::vector ApplicationSettings::getRecentProjects() const } else { - recentProjects.push_back(UserPaths::getUserDataPath().concat(project)); + recentProjects.push_back(UserPaths::getUserDataPath().concatenate(project)); } } return recentProjects; diff --git a/src/lib/settings/ProjectSettings.cpp b/src/lib/settings/ProjectSettings.cpp index 4608bfed..6a5c3a1b 100644 --- a/src/lib/settings/ProjectSettings.cpp +++ b/src/lib/settings/ProjectSettings.cpp @@ -126,7 +126,7 @@ std::string ProjectSettings::getProjectName() const FilePath ProjectSettings::getProjectDirectoryPath() const { - return getFilePath().parentDirectory(); + return getFilePath().getParentDirectory(); } std::string ProjectSettings::getDescription() const @@ -204,7 +204,7 @@ std::vector ProjectSettings::makePathsExpandedAndAbsolute(const std::v std::vector p = expandPaths(paths); std::vector absPaths; - FilePath basePath = getProjectDirectoryPath(); + const FilePath basePath = getProjectDirectoryPath(); for (const FilePath& path : p) { if (path.isAbsolute()) @@ -213,7 +213,7 @@ std::vector ProjectSettings::makePathsExpandedAndAbsolute(const std::v } else { - absPaths.push_back(basePath.concat(path).canonical()); + absPaths.push_back(basePath.getConcatenated(path).makeCanonical()); } } @@ -229,7 +229,7 @@ FilePath ProjectSettings::makePathExpandedAndAbsolute(const FilePath& path) cons return p; } - return getProjectDirectoryPath().concat(p).canonical(); + return getProjectDirectoryPath().concatenate(p).makeCanonical(); } SettingsMigrator ProjectSettings::getMigrations() const diff --git a/src/lib/utility/UserPaths.cpp b/src/lib/utility/UserPaths.cpp index 64fe1397..d8c6fb8b 100644 --- a/src/lib/utility/UserPaths.cpp +++ b/src/lib/utility/UserPaths.cpp @@ -14,15 +14,15 @@ void UserPaths::setUserDataPath(const FilePath& path) FilePath UserPaths::getAppSettingsPath() { - return getUserDataPath().concat(FilePath("ApplicationSettings.xml")); + return getUserDataPath().concatenate(FilePath("ApplicationSettings.xml")); } FilePath UserPaths::getWindowSettingsPath() { - return getUserDataPath().concat(FilePath("window_settings.ini")); + return getUserDataPath().concatenate(FilePath("window_settings.ini")); } FilePath UserPaths::getLogPath() { - return getUserDataPath().concat(FilePath("log/")); + return getUserDataPath().concatenate(FilePath("log/")); } diff --git a/src/lib/utility/commandline/CommandLineParser.cpp b/src/lib/utility/commandline/CommandLineParser.cpp index 14427acb..b880b73e 100644 --- a/src/lib/utility/commandline/CommandLineParser.cpp +++ b/src/lib/utility/commandline/CommandLineParser.cpp @@ -218,7 +218,8 @@ bool CommandLineParser::startedWithLicense() void CommandLineParser::processProjectfile() { - m_projectFile = m_projectFile.absolute(); + m_projectFile.makeAbsolute(); + const std::string errorstring = "Provided Projectfile is not valid:\n* Provided Projectfile('" + m_projectFile.fileName() + "') "; if (!m_projectFile.exists()) diff --git a/src/lib/utility/file/FileManager.cpp b/src/lib/utility/file/FileManager.cpp index 8f5007a9..09d73eca 100644 --- a/src/lib/utility/file/FileManager.cpp +++ b/src/lib/utility/file/FileManager.cpp @@ -63,7 +63,7 @@ std::set FileManager::getAllSourceFilePathsRelative(const FilePath& ba { if (baseDirectory.exists()) { - absolutePaths.insert(path.relativeTo(baseDirectory)); + absolutePaths.insert(path.getRelativeTo(baseDirectory)); } else { @@ -78,7 +78,7 @@ std::vector FileManager::makeCanonical(const std::vector& fi std::vector ret; for (const FilePath& filePath: filePaths) { - ret.push_back(filePath.canonical()); + ret.push_back(filePath.getCanonical()); } return ret; } diff --git a/src/lib/utility/file/FilePath.cpp b/src/lib/utility/file/FilePath.cpp index 4bbf80d5..fadc17fa 100644 --- a/src/lib/utility/file/FilePath.cpp +++ b/src/lib/utility/file/FilePath.cpp @@ -2,13 +2,14 @@ #include +#include "boost/filesystem/path.hpp" #include "boost/filesystem.hpp" #include "utility/logging/logging.h" #include "utility/utilityString.h" FilePath::FilePath() - : m_path("") + : m_path(std::make_unique("")) , m_exists(false) , m_checkedExists(false) , m_isDirectory(false) @@ -18,7 +19,7 @@ FilePath::FilePath() } FilePath::FilePath(const char* filePath) - : m_path(filePath) + : m_path(std::make_unique(filePath)) , m_exists(false) , m_checkedExists(false) , m_isDirectory(false) @@ -28,7 +29,7 @@ FilePath::FilePath(const char* filePath) } FilePath::FilePath(const std::string& filePath) - : m_path(filePath) + : m_path(std::make_unique(filePath)) , m_exists(false) , m_checkedExists(false) , m_isDirectory(false) @@ -38,7 +39,7 @@ FilePath::FilePath(const std::string& filePath) } FilePath::FilePath(const boost::filesystem::path& filePath) - : m_path(filePath) + : m_path(std::make_unique(filePath)) , m_exists(false) , m_checkedExists(false) , m_isDirectory(false) @@ -47,8 +48,28 @@ FilePath::FilePath(const boost::filesystem::path& filePath) { } +FilePath::FilePath(const FilePath& other) + : m_path(std::make_unique(other.getPath())) + , m_exists(other.m_exists) + , m_checkedExists(other.m_checkedExists) + , m_isDirectory(other.m_isDirectory) + , m_checkedIsDirectory(other.m_checkedIsDirectory) + , m_canonicalized(other.m_canonicalized) +{ +} + +FilePath::FilePath(FilePath&& other) + : m_path(std::move(other.m_path)) + , m_exists(other.m_exists) + , m_checkedExists(other.m_checkedExists) + , m_isDirectory(other.m_isDirectory) + , m_checkedIsDirectory(other.m_checkedIsDirectory) + , m_canonicalized(other.m_canonicalized) +{ +} + FilePath::FilePath(const std::string& filePath, const std::string& base) - : m_path(boost::filesystem::absolute(filePath, base)) + : m_path(std::make_unique(boost::filesystem::absolute(filePath, base))) , m_exists(false) , m_checkedExists(false) , m_isDirectory(false) @@ -57,21 +78,25 @@ FilePath::FilePath(const std::string& filePath, const std::string& base) { } -boost::filesystem::path FilePath::path() const +FilePath::~FilePath() { - return m_path; +} + +boost::filesystem::path FilePath::getPath() const +{ + return boost::filesystem::path(*(m_path.get())); } bool FilePath::empty() const { - return m_path.empty(); + return m_path->empty(); } bool FilePath::exists() const { if (!m_checkedExists) { - m_exists = boost::filesystem::exists(m_path); + m_exists = boost::filesystem::exists(getPath()); m_checkedExists = true; } @@ -88,7 +113,7 @@ bool FilePath::isDirectory() const { if (!m_checkedIsDirectory) { - m_isDirectory = boost::filesystem::is_directory(m_path); + m_isDirectory = boost::filesystem::is_directory(getPath()); m_checkedIsDirectory = true; } @@ -97,12 +122,12 @@ bool FilePath::isDirectory() const bool FilePath::isAbsolute() const { - return m_path.is_absolute(); + return m_path->is_absolute(); } -FilePath FilePath::parentDirectory() const +FilePath FilePath::getParentDirectory() const { - FilePath parentDirectory(m_path.parent_path()); + FilePath parentDirectory(m_path->parent_path()); parentDirectory.m_checkedIsDirectory = true; parentDirectory.m_isDirectory = true; @@ -111,25 +136,34 @@ FilePath FilePath::parentDirectory() const parentDirectory.m_checkedExists = true; parentDirectory.m_exists = true; } + return parentDirectory; } -FilePath FilePath::absolute() const +FilePath& FilePath::makeAbsolute() { - return FilePath(boost::filesystem::absolute(m_path)); + m_path = std::make_unique(boost::filesystem::absolute(getPath())); + return *this; } -FilePath FilePath::canonical() const +FilePath FilePath::getAbsolute() const +{ + FilePath path(*this); + path.makeAbsolute(); + return path; +} + +FilePath& FilePath::makeCanonical() { if (m_canonicalized || !exists()) { - return FilePath(*this); + return *this; } boost::filesystem::path canonicalPath; #if defined(_WIN32) - boost::filesystem::path abs_p = boost::filesystem::absolute(m_path); + boost::filesystem::path abs_p = boost::filesystem::absolute(getPath()); for (boost::filesystem::path::iterator it = abs_p.begin(); it != abs_p.end(); ++it) { if (*it == "..") @@ -158,12 +192,18 @@ FilePath FilePath::canonical() const } } #else - canonicalPath = boost::filesystem::canonical(m_path); + canonicalPath = boost::filesystem::canonical(getPath()); #endif + m_path = std::make_unique(canonicalPath); + m_canonicalized = true; + return *this; +} - FilePath ret(canonicalPath); - ret.m_canonicalized = true; - return ret; +FilePath FilePath::getCanonical() const +{ + FilePath path(*this); + path.makeCanonical(); + return path; } std::vector FilePath::expandEnvironmentVariables() const @@ -201,10 +241,10 @@ std::vector FilePath::expandEnvironmentVariables() const return paths; } -FilePath FilePath::relativeTo(const FilePath& other) const +FilePath& FilePath::makeRelativeTo(const FilePath& other) { - boost::filesystem::path a = this->canonical().m_path; - boost::filesystem::path b = other.canonical().m_path; + const boost::filesystem::path a = this->getCanonical().getPath(); + const boost::filesystem::path b = other.getCanonical().getPath(); if (a.root_path() != b.root_path()) { @@ -245,12 +285,35 @@ FilePath FilePath::relativeTo(const FilePath& other) const r = "./"; } - return FilePath(r); + m_path = std::make_unique(r); + return *this; } -FilePath FilePath::concat(const FilePath& other) const + +FilePath FilePath::getRelativeTo(const FilePath& other) const { - return FilePath(boost::filesystem::path(m_path) / other.m_path); + FilePath path(*this); + path.makeRelativeTo(other); + return path; +} + +FilePath& FilePath::concatenate(const FilePath& other) +{ + m_path->operator/=(other.getPath()); + m_exists = false; + m_checkedExists = false; + m_isDirectory = false; + m_checkedIsDirectory = false; + m_canonicalized = false; + + return *this; +} + +FilePath FilePath::getConcatenated(const FilePath& other) const +{ + FilePath path(*this); + path.concatenate(other); + return path; } bool FilePath::contains(const FilePath& other) const @@ -260,8 +323,8 @@ bool FilePath::contains(const FilePath& other) const return false; } - boost::filesystem::path dir = m_path; - const boost::filesystem::path& dir2 = other.m_path; + boost::filesystem::path dir = getPath(); + const std::unique_ptr& dir2 = other.m_path; if (dir.filename() == ".") { @@ -269,11 +332,11 @@ bool FilePath::contains(const FilePath& other) const } auto it = dir.begin(); - auto it2 = dir2.begin(); + auto it2 = dir2->begin(); while (it != dir.end()) { - if (it2 == dir2.end()) + if (it2 == dir2->end()) { return false; } @@ -292,7 +355,7 @@ bool FilePath::contains(const FilePath& other) const std::string FilePath::str() const { - return m_path.generic_string(); + return m_path->generic_string(); } std::string FilePath::getBackslashedString() const @@ -302,22 +365,22 @@ std::string FilePath::getBackslashedString() const std::string FilePath::fileName() const { - return m_path.filename().generic_string(); + return m_path->filename().generic_string(); } std::string FilePath::extension() const { - return m_path.extension().generic_string(); + return m_path->extension().generic_string(); } FilePath FilePath::withoutExtension() const { - return FilePath(boost::filesystem::path(m_path).replace_extension()); + return FilePath(getPath().replace_extension()); } FilePath FilePath::replaceExtension(const std::string& extension) const { - return FilePath(boost::filesystem::path(m_path).replace_extension(extension)); + return FilePath(getPath().replace_extension(extension)); } bool FilePath::hasExtension(const std::vector& extensions) const @@ -333,14 +396,36 @@ bool FilePath::hasExtension(const std::vector& extensions) const return false; } +FilePath& FilePath::operator=(const FilePath& other) +{ + m_path = std::make_unique(other.getPath()); + m_exists = other.m_exists; + m_checkedExists = other.m_checkedExists; + m_isDirectory = other.m_isDirectory; + m_checkedIsDirectory = other.m_checkedIsDirectory; + m_canonicalized = other.m_canonicalized; + return *this; +} + +FilePath& FilePath::operator=(FilePath&& other) +{ + m_path = std::move(other.m_path); + m_exists = other.m_exists; + m_checkedExists = other.m_checkedExists; + m_isDirectory = other.m_isDirectory; + m_checkedIsDirectory = other.m_checkedIsDirectory; + m_canonicalized = other.m_canonicalized; + return *this; +} + bool FilePath::operator==(const FilePath& other) const { if (exists() && other.exists()) { - return boost::filesystem::equivalent(m_path, other.m_path); + return boost::filesystem::equivalent(getPath(), other.getPath()); } - return m_path.compare(other.m_path) == 0; + return m_path->compare(other.getPath()) == 0; } bool FilePath::operator!=(const FilePath& other) const @@ -350,5 +435,5 @@ bool FilePath::operator!=(const FilePath& other) const bool FilePath::operator<(const FilePath& other) const { - return m_path.compare(other.m_path) < 0; + return m_path->compare(other.getPath()) < 0; } diff --git a/src/lib/utility/file/FilePath.h b/src/lib/utility/file/FilePath.h index 8abbf2b5..9fcd4c56 100644 --- a/src/lib/utility/file/FilePath.h +++ b/src/lib/utility/file/FilePath.h @@ -3,8 +3,15 @@ #include #include +#include -#include "boost/filesystem/path.hpp" +namespace boost +{ + namespace filesystem + { + class path; + } +} class FilePath { @@ -13,9 +20,12 @@ public: explicit FilePath(const char* filePath); explicit FilePath(const std::string& filePath); explicit FilePath(const boost::filesystem::path& filePath); + FilePath(const FilePath& filePath); + FilePath(FilePath&& other); FilePath(const std::string& filePath, const std::string& base); + ~FilePath(); - boost::filesystem::path path() const; + boost::filesystem::path getPath() const; bool empty() const; bool exists() const; @@ -23,12 +33,16 @@ public: bool isDirectory() const; bool isAbsolute() const; - FilePath parentDirectory() const; + FilePath getParentDirectory() const; - FilePath absolute() const; - FilePath canonical() const; - FilePath relativeTo(const FilePath& other) const; - FilePath concat(const FilePath& other) const; + FilePath& makeAbsolute(); + FilePath getAbsolute() const; + FilePath& makeCanonical(); + FilePath getCanonical() const; + FilePath& makeRelativeTo(const FilePath& other); + FilePath getRelativeTo(const FilePath& other) const; + FilePath& concatenate(const FilePath& other); + FilePath getConcatenated(const FilePath& other) const; std::vector expandEnvironmentVariables() const; bool contains(const FilePath& other) const; @@ -42,12 +56,14 @@ public: FilePath replaceExtension(const std::string& extension) const; bool hasExtension(const std::vector& extensions) const; + FilePath& operator=(const FilePath& other); + FilePath& operator=(FilePath&& other); bool operator==(const FilePath& other) const; bool operator!=(const FilePath& other) const; bool operator<(const FilePath& other) const; private: - boost::filesystem::path m_path; + std::unique_ptr m_path; mutable bool m_exists; mutable bool m_checkedExists; diff --git a/src/lib/utility/file/FileSystem.cpp b/src/lib/utility/file/FileSystem.cpp index 9a156cf5..4bb7e731 100644 --- a/src/lib/utility/file/FileSystem.cpp +++ b/src/lib/utility/file/FileSystem.cpp @@ -13,9 +13,9 @@ std::vector FileSystem::getFilePathsFromDirectory( std::set ext(extensions.begin(), extensions.end()); std::vector files; - if (boost::filesystem::is_directory(path.path())) + if (path.isDirectory()) { - boost::filesystem::recursive_directory_iterator it(path.path()); + boost::filesystem::recursive_directory_iterator it(path.getPath()); boost::filesystem::recursive_directory_iterator endit; while (it != endit) { @@ -44,9 +44,7 @@ FileInfo FileSystem::getFileInfoForPath(const FilePath& filePath) { if (filePath.exists()) { - std::time_t t = boost::filesystem::last_write_time(filePath.path()); - boost::posix_time::ptime lastWriteTime = boost::posix_time::from_time_t(t); - return FileInfo(filePath, lastWriteTime); + return FileInfo(filePath, getLastWriteTime(filePath)); } return FileInfo(); } @@ -69,7 +67,7 @@ std::vector FileSystem::getFileInfosFromPaths( { if (path.isDirectory()) { - boost::filesystem::recursive_directory_iterator it(path.path(), boost::filesystem::symlink_option::recurse); + boost::filesystem::recursive_directory_iterator it(path.getPath(), boost::filesystem::symlink_option::recurse); boost::filesystem::recursive_directory_iterator endit; boost::system::error_code ec; for ( ; it != endit ; it.increment(ec) ) @@ -113,25 +111,20 @@ std::vector FileSystem::getFileInfosFromPaths( continue; } filePaths.insert(p); - - std::time_t t = boost::filesystem::last_write_time(*it); - boost::posix_time::ptime lastWriteTime = boost::posix_time::from_time_t(t); - files.push_back(FileInfo(FilePath(it->path()), lastWriteTime)); + files.push_back(getFileInfoForPath(FilePath(it->path()))); } } } else if (path.exists() && (!ext.size() || ext.find(utility::toLowerCase(path.extension())) != ext.end())) { - boost::filesystem::path p = boost::filesystem::canonical(path.path()); + const FilePath canonicalPath = path.getCanonical(); + boost::filesystem::path p = canonicalPath.getPath(); if (filePaths.find(p) != filePaths.end()) { continue; } filePaths.insert(p); - - std::time_t t = boost::filesystem::last_write_time(path.path()); - boost::posix_time::ptime lastWriteTime = boost::posix_time::from_time_t(t); - files.push_back(FileInfo(path, lastWriteTime)); + files.push_back(getFileInfoForPath(canonicalPath)); } } @@ -147,7 +140,7 @@ std::set FileSystem::getSymLinkedDirectories(const std::vector FileSystem::getSymLinkedDirectories(const std::vector FileSystem::getDirectSubDirectories(const FilePath& path) return v; } - std::vector FileSystem::getRecursiveSubDirectories(const FilePath &path) { std::vector v; diff --git a/src/lib/utility/file/FileSystem.h b/src/lib/utility/file/FileSystem.h index 1bb611ce..25b18146 100644 --- a/src/lib/utility/file/FileSystem.h +++ b/src/lib/utility/file/FileSystem.h @@ -26,7 +26,6 @@ public: static TimeStamp getLastWriteTime(const FilePath& filePath); static std::string getTimeStringNow(); - static bool exists(const FilePath& path); static bool remove(const FilePath& path); static bool rename(const FilePath& from, const FilePath& to); diff --git a/src/lib_cxx/data/indexer/IndexerCommandCxxCdb.cpp b/src/lib_cxx/data/indexer/IndexerCommandCxxCdb.cpp index b82af77d..8b373e63 100644 --- a/src/lib_cxx/data/indexer/IndexerCommandCxxCdb.cpp +++ b/src/lib_cxx/data/indexer/IndexerCommandCxxCdb.cpp @@ -23,10 +23,10 @@ std::vector IndexerCommandCxxCdb::getSourceFilesFromCDB(const FilePath { for (const clang::tooling::CompileCommand& command : cdb->getAllCompileCommands()) { - FilePath path = FilePath(command.Filename).canonical(); + FilePath path = FilePath(command.Filename).makeCanonical(); if (!path.isAbsolute()) { - path = FilePath(command.Directory + '/' + command.Filename).canonical(); + path = FilePath(command.Directory + '/' + command.Filename).makeCanonical(); } filePaths.push_back(path); } diff --git a/src/lib_cxx/data/parser/cxx/CanonicalFilePathCache.cpp b/src/lib_cxx/data/parser/cxx/CanonicalFilePathCache.cpp index 82a9539e..206191cb 100644 --- a/src/lib_cxx/data/parser/cxx/CanonicalFilePathCache.cpp +++ b/src/lib_cxx/data/parser/cxx/CanonicalFilePathCache.cpp @@ -19,7 +19,7 @@ FilePath CanonicalFilePathCache::getCanonicalFilePath(const std::string& path) return it->second; } - const FilePath canonicalPath = FilePath(path).canonical(); + const FilePath canonicalPath = FilePath(path).makeCanonical(); const std::string lowercaseCanonicalPath = utility::toLowerCase(canonicalPath.str()); m_map.insert(std::make_pair(lowercasePath, canonicalPath)); diff --git a/src/lib_cxx/data/parser/cxx/CxxAstVisitor.cpp b/src/lib_cxx/data/parser/cxx/CxxAstVisitor.cpp index 4553a238..c5e40cb5 100644 --- a/src/lib_cxx/data/parser/cxx/CxxAstVisitor.cpp +++ b/src/lib_cxx/data/parser/cxx/CxxAstVisitor.cpp @@ -650,7 +650,7 @@ ParseLocation CxxAstVisitor::getParseLocation(const clang::SourceLocation& sourc ParseLocation parseLocation; if (sourceLocation.isValid()) { - clang::SourceManager& sourceManager = m_astContext->getSourceManager(); + const clang::SourceManager& sourceManager = m_astContext->getSourceManager(); clang::SourceLocation loc = sourceLocation; if (sourceManager.isMacroBodyExpansion(sourceLocation)) @@ -662,8 +662,8 @@ ParseLocation CxxAstVisitor::getParseLocation(const clang::SourceLocation& sourc } } - clang::SourceLocation startLoc = sourceManager.getSpellingLoc(loc); - clang::FileID fileId = sourceManager.getFileID(startLoc); + const clang::SourceLocation startLoc = sourceManager.getSpellingLoc(loc); + const clang::FileID fileId = sourceManager.getFileID(startLoc); // find the location file if (!fileId.isInvalid()) @@ -677,15 +677,15 @@ ParseLocation CxxAstVisitor::getParseLocation(const clang::SourceLocation& sourc // find the start location { - unsigned int offset = sourceManager.getFileOffset(startLoc); + const unsigned int offset = sourceManager.getFileOffset(startLoc); parseLocation.startLineNumber = sourceManager.getLineNumber(fileId, offset); parseLocation.startColumnNumber = sourceManager.getColumnNumber(fileId, offset); } // General case -- find the end of the token starting at loc. { - clang::SourceLocation endSloc = m_preprocessor->getLocForEndOfToken(startLoc); - unsigned int offset = sourceManager.getFileOffset(endSloc); + const clang::SourceLocation endSloc = m_preprocessor->getLocForEndOfToken(startLoc); + const unsigned int offset = sourceManager.getFileOffset(endSloc); parseLocation.endLineNumber = sourceManager.getLineNumber(fileId, offset); parseLocation.endColumnNumber = sourceManager.getColumnNumber(fileId, offset) - 1; } diff --git a/src/lib_cxx/data/parser/cxx/CxxAstVisitorComponentIndexer.cpp b/src/lib_cxx/data/parser/cxx/CxxAstVisitorComponentIndexer.cpp index b636add1..6856bd59 100644 --- a/src/lib_cxx/data/parser/cxx/CxxAstVisitorComponentIndexer.cpp +++ b/src/lib_cxx/data/parser/cxx/CxxAstVisitorComponentIndexer.cpp @@ -886,7 +886,7 @@ bool CxxAstVisitorComponentIndexer::isLocatedInProjectFile(clang::SourceLocation fileId = sourceManager.getFileID(loc); } - if (!fileId.isInvalid()) + if (fileId.isValid()) { auto it = m_inProjectFileMap.find(fileId); if (it != m_inProjectFileMap.end()) @@ -898,7 +898,7 @@ bool CxxAstVisitorComponentIndexer::isLocatedInProjectFile(clang::SourceLocation if (fileEntry != nullptr && fileEntry->isValid()) { FilePath filePath = getAstVisitor()->getCanonicalFilePathCache()->getCanonicalFilePath(fileEntry); - bool ret = m_fileRegister->hasFilePath(filePath); + const bool ret = m_fileRegister->hasFilePath(filePath); m_inProjectFileMap[fileId] = ret; return ret; } diff --git a/src/lib_cxx/data/parser/cxx/PreprocessorCallbacks.cpp b/src/lib_cxx/data/parser/cxx/PreprocessorCallbacks.cpp index eee413d0..21c2bbe2 100644 --- a/src/lib_cxx/data/parser/cxx/PreprocessorCallbacks.cpp +++ b/src/lib_cxx/data/parser/cxx/PreprocessorCallbacks.cpp @@ -44,11 +44,11 @@ void PreprocessorCallbacks::FileChanged( if (!m_fileRegister->fileIsIndexed(filePath)) { - m_currentPath = filePath; + m_currentPath = std::move(filePath); if (reason == EnterFile) { - m_fileRegister->markFileIndexing(filePath); + m_fileRegister->markFileIndexing(m_currentPath); } } } diff --git a/src/lib_cxx/data/parser/cxx/utilityClang.cpp b/src/lib_cxx/data/parser/cxx/utilityClang.cpp index fab1f015..fabd6820 100644 --- a/src/lib_cxx/data/parser/cxx/utilityClang.cpp +++ b/src/lib_cxx/data/parser/cxx/utilityClang.cpp @@ -120,7 +120,7 @@ std::string utility::getFileNameOfFileEntry(const clang::FileEntry* entry) } else { - fileName = FilePath(entry->getName().str()).parentDirectory().concat(FilePath(FilePath(fileName).fileName())).str(); + fileName = FilePath(entry->getName().str()).getParentDirectory().concatenate(FilePath(FilePath(fileName).fileName())).str(); } } return fileName; diff --git a/src/lib_cxx/project/IncludeValidation.cpp b/src/lib_cxx/project/IncludeValidation.cpp index b384130f..ed1b958e 100644 --- a/src/lib_cxx/project/IncludeValidation.cpp +++ b/src/lib_cxx/project/IncludeValidation.cpp @@ -58,7 +58,7 @@ std::vector IncludeValidation::getUnresolvedIncludeDirectives( for (const IncludeDirective& includeDirective: getIncludeDirectives(filePath)) { const FilePath resolvedIncludePath = - resolveIncludeDirective(includeDirective, headerSearchDirectories).canonical(); + resolveIncludeDirective(includeDirective, headerSearchDirectories).makeCanonical(); if (resolvedIncludePath.empty()) { unresolvedIncludeDirectives.insert(includeDirective); @@ -142,7 +142,7 @@ FilePath IncludeValidation::resolveIncludeDirective(const IncludeDirective& incl { // check for an include path relative to the including path - FilePath resolvedIncludePath = includeDirective.getIncludingFile().parentDirectory().concat(includeDirective.getIncludedFile()); + const FilePath resolvedIncludePath = includeDirective.getIncludingFile().getParentDirectory().concatenate(includeDirective.getIncludedFile()); if (resolvedIncludePath.exists()) { return resolvedIncludePath; @@ -153,7 +153,7 @@ FilePath IncludeValidation::resolveIncludeDirective(const IncludeDirective& incl // check for an include path relative to the header search directories for (const FilePath& headerSearchDirectory: headerSearchDirectories) { - FilePath resolvedIncludePath = headerSearchDirectory.concat(includeDirective.getIncludedFile()); + const FilePath resolvedIncludePath = headerSearchDirectory.getConcatenated(includeDirective.getIncludedFile()); if (resolvedIncludePath.exists()) { return resolvedIncludePath; diff --git a/src/lib_cxx/project/SourceGroupCxxCdb.cpp b/src/lib_cxx/project/SourceGroupCxxCdb.cpp index a80e9e4f..d38d6c50 100644 --- a/src/lib_cxx/project/SourceGroupCxxCdb.cpp +++ b/src/lib_cxx/project/SourceGroupCxxCdb.cpp @@ -99,10 +99,10 @@ std::vector> SourceGroupCxxCdb::getIndexerComman for (const clang::tooling::CompileCommand& command: cdb->getAllCompileCommands()) { - FilePath sourcePath = FilePath(command.Filename).canonical(); + FilePath sourcePath = FilePath(command.Filename).makeCanonical(); if (!sourcePath.isAbsolute()) { - sourcePath = FilePath(command.Directory + '/' + command.Filename).canonical(); + sourcePath = FilePath(command.Directory + '/' + command.Filename).makeCanonical(); } if (filesToIndex.find(sourcePath) != filesToIndex.end() && diff --git a/src/lib_cxx/utility/CompilationDatabase.cpp b/src/lib_cxx/utility/CompilationDatabase.cpp index da28aa02..54ab05f0 100644 --- a/src/lib_cxx/utility/CompilationDatabase.cpp +++ b/src/lib_cxx/utility/CompilationDatabase.cpp @@ -65,19 +65,19 @@ void utility::CompilationDatabase::init() if (utility::isPrefix(frameworkIncludeFlag, argument)) { - frameworkHeaders.insert(FilePath(utility::trim(argument.substr(frameworkIncludeFlag.size())), command.Directory).canonical()); + frameworkHeaders.insert(FilePath(utility::trim(argument.substr(frameworkIncludeFlag.size())), command.Directory).makeCanonical()); } else if (utility::isPrefix(systemIncludeFlag, argument)) { - systemHeaders.insert(FilePath(utility::trim(argument.substr(systemIncludeFlag.size())), command.Directory).canonical()); + systemHeaders.insert(FilePath(utility::trim(argument.substr(systemIncludeFlag.size())), command.Directory).makeCanonical()); } else if (utility::isPrefix(quoteFlag, argument)) { - headers.insert(FilePath(utility::trim(argument.substr(quoteFlag.size())), command.Directory).canonical()); + headers.insert(FilePath(utility::trim(argument.substr(quoteFlag.size())), command.Directory).makeCanonical()); } else if (utility::isPrefix(includeFlag, argument)) { - headers.insert(FilePath(utility::trim(argument.substr(includeFlag.size())), command.Directory).canonical()); + headers.insert(FilePath(utility::trim(argument.substr(includeFlag.size())), command.Directory).makeCanonical()); } } } diff --git a/src/lib_gui/platform_includes/includesWindows.h b/src/lib_gui/platform_includes/includesWindows.h index e4fc5b04..f2a9676a 100644 --- a/src/lib_gui/platform_includes/includesWindows.h +++ b/src/lib_gui/platform_includes/includesWindows.h @@ -40,28 +40,28 @@ void setupApp(int argc, char *argv[]) // This "copyFile" method does nothing if the copy destination already exist -#ifdef DEPLOY +#ifdef DEPLOY // try to find files in Coati installation to migrate to Sourcetrail - FilePath coatiUserDataPath = UserPaths::getUserDataPath().concat(FilePath("../")); + FilePath coatiUserDataPath = UserPaths::getUserDataPath().concatenate(FilePath("../")); if (utility::getApplicationArchitectureType() == APPLICATION_ARCHITECTURE_X86_64) { - coatiUserDataPath = coatiUserDataPath.concat(FilePath("Coati 64-bit")); + coatiUserDataPath = coatiUserDataPath.concatenate(FilePath("Coati 64-bit")); } else { - coatiUserDataPath = coatiUserDataPath.concat(FilePath("Coati")); + coatiUserDataPath = coatiUserDataPath.concatenate(FilePath("Coati")); } if (coatiUserDataPath.exists()) { - FileSystem::copyFile(coatiUserDataPath.concat(FilePath("ApplicationSettings.xml")), UserPaths::getAppSettingsPath()); - FileSystem::copyFile(coatiUserDataPath.concat(FilePath("window_settings.ini")), UserPaths::getWindowSettingsPath()); + FileSystem::copyFile(coatiUserDataPath.concatenate(FilePath("ApplicationSettings.xml")), UserPaths::getAppSettingsPath()); + FileSystem::copyFile(coatiUserDataPath.concatenate(FilePath("window_settings.ini")), UserPaths::getWindowSettingsPath()); } #endif // use files in fallback folder if Coati has not been installed and used before - FileSystem::copyFile(ResourcePaths::getFallbackPath().concat(FilePath("ApplicationSettings.xml")), UserPaths::getAppSettingsPath()); - FileSystem::copyFile(ResourcePaths::getFallbackPath().concat(FilePath("window_settings.ini")), UserPaths::getWindowSettingsPath()); + FileSystem::copyFile(ResourcePaths::getFallbackPath().concatenate(FilePath("ApplicationSettings.xml")), UserPaths::getAppSettingsPath()); + FileSystem::copyFile(ResourcePaths::getFallbackPath().concatenate(FilePath("window_settings.ini")), UserPaths::getWindowSettingsPath()); } #endif // INCLUDES_WINDOWS_H diff --git a/src/lib_gui/qt/element/QtDirectoryListBox.cpp b/src/lib_gui/qt/element/QtDirectoryListBox.cpp index 25dbf610..cbe693d2 100644 --- a/src/lib_gui/qt/element/QtDirectoryListBox.cpp +++ b/src/lib_gui/qt/element/QtDirectoryListBox.cpp @@ -58,8 +58,8 @@ void QtListItemWidget::setText(QString text) FilePath relativeRoot = m_list->getRelativeRootDirectory(); if (!relativeRoot.empty()) { - FilePath path(text.toStdString()); - FilePath relPath(path.relativeTo(relativeRoot)); + const FilePath path(text.toStdString()); + const FilePath relPath = path.getRelativeTo(relativeRoot); if (relPath.str().size() < path.str().size()) { text = QString::fromStdString(relPath.str()); @@ -77,10 +77,10 @@ void QtListItemWidget::setFocus() void QtListItemWidget::handleButtonPress() { FilePath path(m_data->text().toStdString()); - FilePath relativeRoot = m_list->getRelativeRootDirectory(); + const FilePath relativeRoot = m_list->getRelativeRootDirectory(); if (!path.empty() && !path.isAbsolute() && !relativeRoot.empty()) { - path = relativeRoot.concat(path); + path = relativeRoot.getConcatenated(path); } QStringList list = QtFileDialog::getFileNamesAndDirectories(this, QString::fromStdString(path.str())); @@ -118,7 +118,7 @@ QtDirectoryListBox::QtDirectoryListBox(QWidget *parent, const QString& listName, m_list->setAttribute(Qt::WA_MacShowFocusRect, 0); m_list->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); - setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("window/listbox.css"))).c_str()); + setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("window/listbox.css"))).c_str()); layout->addWidget(m_list); QWidget* buttonContainer = new QWidget(this); diff --git a/src/lib_gui/qt/element/QtHistoryList.cpp b/src/lib_gui/qt/element/QtHistoryList.cpp index e856121b..48ed2440 100644 --- a/src/lib_gui/qt/element/QtHistoryList.cpp +++ b/src/lib_gui/qt/element/QtHistoryList.cpp @@ -127,7 +127,7 @@ QtHistoryList::QtHistoryList(const std::vector& history, size_t cur m_list->setItemWidget(item, line); } - setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("history_list/history_list.css"))).c_str()); + setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("history_list/history_list.css"))).c_str()); connect(m_list, &QListWidget::itemClicked, this, &QtHistoryList::onItemClicked); } diff --git a/src/lib_gui/qt/element/QtLocationPicker.cpp b/src/lib_gui/qt/element/QtLocationPicker.cpp index dc5c3010..24a78351 100644 --- a/src/lib_gui/qt/element/QtLocationPicker.cpp +++ b/src/lib_gui/qt/element/QtLocationPicker.cpp @@ -102,7 +102,7 @@ void QtLocationPicker::handleButtonPress() FilePath path(m_data->text().toStdString()); if (!path.empty() && !path.isAbsolute() && !m_relativeRootDirectory.empty()) { - path = m_relativeRootDirectory.concat(path); + path = m_relativeRootDirectory.getConcatenated(path); } QString fileName; @@ -119,8 +119,8 @@ void QtLocationPicker::handleButtonPress() { if (!m_relativeRootDirectory.empty()) { - FilePath path(fileName.toStdString()); - FilePath relPath(path.relativeTo(m_relativeRootDirectory)); + const FilePath path(fileName.toStdString()); + const FilePath relPath = path.getRelativeTo(m_relativeRootDirectory); if (relPath.str().size() < path.str().size()) { fileName = QString::fromStdString(relPath.str()); diff --git a/src/lib_gui/qt/utility/QtContextMenu.cpp b/src/lib_gui/qt/utility/QtContextMenu.cpp index 874db54d..41125615 100644 --- a/src/lib_gui/qt/utility/QtContextMenu.cpp +++ b/src/lib_gui/qt/utility/QtContextMenu.cpp @@ -119,7 +119,7 @@ void QtContextMenu::copyFullPathActionTriggered() void QtContextMenu::openContainingFolderActionTriggered() { - FilePath dir = s_filePath.parentDirectory(); + FilePath dir = s_filePath.getParentDirectory(); if (dir.exists()) { QDesktopServices::openUrl(QUrl(("file:///" + dir.str()).c_str(), QUrl::TolerantMode)); diff --git a/src/lib_gui/qt/view/QtBookmarkView.cpp b/src/lib_gui/qt/view/QtBookmarkView.cpp index 788a7d16..4e78efd7 100644 --- a/src/lib_gui/qt/view/QtBookmarkView.cpp +++ b/src/lib_gui/qt/view/QtBookmarkView.cpp @@ -250,7 +250,8 @@ void QtBookmarkView::showBookmarksClicked() void QtBookmarkView::setStyleSheet() { m_widget->setStyleSheet(utility::getStyleSheet( - ResourcePaths::getGuiPath().concat(FilePath("bookmark_view/bookmark_view.css"))).c_str()); + ResourcePaths::getGuiPath().concatenate(FilePath("bookmark_view/bookmark_view.css")) + ).c_str()); } void QtBookmarkView::refreshStyle() diff --git a/src/lib_gui/qt/view/QtCodeView.cpp b/src/lib_gui/qt/view/QtCodeView.cpp index 84cf889d..1894b7f0 100644 --- a/src/lib_gui/qt/view/QtCodeView.cpp +++ b/src/lib_gui/qt/view/QtCodeView.cpp @@ -285,7 +285,7 @@ void QtCodeView::setStyleSheet() const { utility::setWidgetBackgroundColor(m_widget, ColorScheme::getInstance()->getColor("code/background")); - std::string styleSheet = utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("code_view/code_view.css"))); + std::string styleSheet = utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("code_view/code_view.css"))); m_widget->setStyleSheet(styleSheet.c_str()); } diff --git a/src/lib_gui/qt/view/QtGraphView.cpp b/src/lib_gui/qt/view/QtGraphView.cpp index ed4db57b..18646747 100644 --- a/src/lib_gui/qt/view/QtGraphView.cpp +++ b/src/lib_gui/qt/view/QtGraphView.cpp @@ -162,7 +162,7 @@ void QtGraphView::refreshView() QtGraphicsView* view = getView(); - std::string css = utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("graph_view/graph_view.css"))); + std::string css = utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("graph_view/graph_view.css"))); view->setStyleSheet(css.c_str()); view->setAppZoomFactor(GraphViewStyle::getZoomFactor()); view->refreshStyle(); diff --git a/src/lib_gui/qt/view/QtRefreshView.cpp b/src/lib_gui/qt/view/QtRefreshView.cpp index c9920326..683278cb 100644 --- a/src/lib_gui/qt/view/QtRefreshView.cpp +++ b/src/lib_gui/qt/view/QtRefreshView.cpp @@ -37,5 +37,5 @@ void QtRefreshView::refreshView() void QtRefreshView::setStyleSheet() { m_widget->setStyleSheet(utility::getStyleSheet( - ResourcePaths::getGuiPath().concat(FilePath("refresh_view/refresh_view.css"))).c_str()); + ResourcePaths::getGuiPath().concatenate(FilePath("refresh_view/refresh_view.css"))).c_str()); } diff --git a/src/lib_gui/qt/view/QtScreenSearchView.cpp b/src/lib_gui/qt/view/QtScreenSearchView.cpp index 66c6502b..3a9f7803 100644 --- a/src/lib_gui/qt/view/QtScreenSearchView.cpp +++ b/src/lib_gui/qt/view/QtScreenSearchView.cpp @@ -45,7 +45,7 @@ void QtScreenSearchView::refreshView() m_onQtThread([=]() { m_bar->setStyleSheet( - utility::getStyleSheet(ResourcePaths::getGuiPath().concat( + utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate( FilePath("screen_search_view/screen_search_view.css"))).c_str() ); diff --git a/src/lib_gui/qt/view/QtSearchView.cpp b/src/lib_gui/qt/view/QtSearchView.cpp index 7e9b7212..69bf7fad 100644 --- a/src/lib_gui/qt/view/QtSearchView.cpp +++ b/src/lib_gui/qt/view/QtSearchView.cpp @@ -78,7 +78,7 @@ void QtSearchView::setAutocompletionList(const std::vector& autocom void QtSearchView::setStyleSheet() { - std::string css = utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("search_view/search_view.css"))); + std::string css = utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("search_view/search_view.css"))); m_widget->setStyleSheet(css.c_str()); diff --git a/src/lib_gui/qt/view/QtTabbedView.cpp b/src/lib_gui/qt/view/QtTabbedView.cpp index fe591a43..36ca8e87 100644 --- a/src/lib_gui/qt/view/QtTabbedView.cpp +++ b/src/lib_gui/qt/view/QtTabbedView.cpp @@ -65,6 +65,6 @@ void QtTabbedView::setStyleSheet() QtViewWidgetWrapper::getWidgetOfView(this), ColorScheme::getInstance()->getColor("tab/background")); m_widget->setStyleSheet( - utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("tabbed_view/tabbed_view.css"))).c_str() + utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("tabbed_view/tabbed_view.css"))).c_str() ); } diff --git a/src/lib_gui/qt/view/QtTooltipView.cpp b/src/lib_gui/qt/view/QtTooltipView.cpp index 82e0cbc8..fd62f554 100644 --- a/src/lib_gui/qt/view/QtTooltipView.cpp +++ b/src/lib_gui/qt/view/QtTooltipView.cpp @@ -31,7 +31,7 @@ void QtTooltipView::refreshView() m_onQtThread([=]() { m_widget->setStyleSheet( - utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("tooltip_view/tooltip_view.css"))).c_str() + utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("tooltip_view/tooltip_view.css"))).c_str() ); }); } diff --git a/src/lib_gui/qt/view/QtUndoRedoView.cpp b/src/lib_gui/qt/view/QtUndoRedoView.cpp index 8c0ff1cf..a7d6b6e8 100644 --- a/src/lib_gui/qt/view/QtUndoRedoView.cpp +++ b/src/lib_gui/qt/view/QtUndoRedoView.cpp @@ -69,5 +69,5 @@ void QtUndoRedoView::updateHistory(const std::vector& searchMatches void QtUndoRedoView::setStyleSheet() { m_widget->setStyleSheet(utility::getStyleSheet( - ResourcePaths::getGuiPath().concat(FilePath("undoredo_view/undoredo_view.css"))).c_str()); + ResourcePaths::getGuiPath().concatenate(FilePath("undoredo_view/undoredo_view.css"))).c_str()); } diff --git a/src/lib_gui/qt/window/QtAbout.cpp b/src/lib_gui/qt/window/QtAbout.cpp index b0dd3f38..2ce10971 100644 --- a/src/lib_gui/qt/window/QtAbout.cpp +++ b/src/lib_gui/qt/window/QtAbout.cpp @@ -23,7 +23,7 @@ QSize QtAbout::sizeHint() const void QtAbout::setupAbout() { - setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("about/about.css"))).c_str()); + setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("about/about.css"))).c_str()); QVBoxLayout* windowLayout = new QVBoxLayout(); windowLayout->setContentsMargins(10, 10, 10, 0); diff --git a/src/lib_gui/qt/window/QtBookmarkBrowser.cpp b/src/lib_gui/qt/window/QtBookmarkBrowser.cpp index 9871c046..2919b6d3 100644 --- a/src/lib_gui/qt/window/QtBookmarkBrowser.cpp +++ b/src/lib_gui/qt/window/QtBookmarkBrowser.cpp @@ -24,8 +24,8 @@ QtBookmarkBrowser::~QtBookmarkBrowser() void QtBookmarkBrowser::setupBookmarkBrowser() { setStyleSheet(( - utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("window/window.css"))) + - utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("bookmark_view/bookmark_view.css"))) + utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("window/window.css"))) + + utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("bookmark_view/bookmark_view.css"))) ).c_str()); m_headerBackground = new QWidget(m_window); diff --git a/src/lib_gui/qt/window/QtBookmarkCreator.cpp b/src/lib_gui/qt/window/QtBookmarkCreator.cpp index badf9cd8..c51f2017 100644 --- a/src/lib_gui/qt/window/QtBookmarkCreator.cpp +++ b/src/lib_gui/qt/window/QtBookmarkCreator.cpp @@ -106,8 +106,8 @@ void QtBookmarkCreator::setupBookmarkCreator() void QtBookmarkCreator::refreshStyle() { setStyleSheet(( - utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("window/window.css"))) + - utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("bookmark_view/bookmark_view.css"))) + utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("window/window.css"))) + + utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("bookmark_view/bookmark_view.css"))) ).c_str()); } diff --git a/src/lib_gui/qt/window/QtIndexingDialog.cpp b/src/lib_gui/qt/window/QtIndexingDialog.cpp index 0e8db02a..eeee4b15 100644 --- a/src/lib_gui/qt/window/QtIndexingDialog.cpp +++ b/src/lib_gui/qt/window/QtIndexingDialog.cpp @@ -378,8 +378,8 @@ QBoxLayout* QtIndexingDialog::createLayout() ); setStyleSheet(( - utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("window/window.css"))) + - utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("indexing_dialog/indexing_dialog.css"))) + utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("window/window.css"))) + + utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("indexing_dialog/indexing_dialog.css"))) ).c_str()); QVBoxLayout* layout = new QVBoxLayout(this); diff --git a/src/lib_gui/qt/window/QtKeyboardShortcuts.cpp b/src/lib_gui/qt/window/QtKeyboardShortcuts.cpp index 1540b468..434308ca 100644 --- a/src/lib_gui/qt/window/QtKeyboardShortcuts.cpp +++ b/src/lib_gui/qt/window/QtKeyboardShortcuts.cpp @@ -70,7 +70,7 @@ void QtKeyboardShortcuts::populateWindow(QWidget* widget) widget->setLayout(layout); - widget->setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("keyboard_shortcuts/keyboard_shortcuts.css"))).c_str()); + widget->setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("keyboard_shortcuts/keyboard_shortcuts.css"))).c_str()); } void QtKeyboardShortcuts::windowReady() diff --git a/src/lib_gui/qt/window/QtLicenseWindow.cpp b/src/lib_gui/qt/window/QtLicenseWindow.cpp index 1de1d55b..15ad0791 100644 --- a/src/lib_gui/qt/window/QtLicenseWindow.cpp +++ b/src/lib_gui/qt/window/QtLicenseWindow.cpp @@ -134,7 +134,7 @@ void QtLicenseWindow::populateWindow(QWidget* widget) void QtLicenseWindow::windowReady() { m_content->setStyleSheet(m_content->styleSheet() + - utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("license/license.css"))).c_str()); + utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("license/license.css"))).c_str()); addLogo(); diff --git a/src/lib_gui/qt/window/QtMainWindow.cpp b/src/lib_gui/qt/window/QtMainWindow.cpp index 36c9f6df..7d98a926 100644 --- a/src/lib_gui/qt/window/QtMainWindow.cpp +++ b/src/lib_gui/qt/window/QtMainWindow.cpp @@ -128,7 +128,7 @@ QtMainWindow::QtMainWindow() { // can only be done once, because resetting the style on the QCoreApplication causes crash app->setStyleSheet( - utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("scrollbar.css"))).c_str()); + utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("scrollbar.css"))).c_str()); } m_recentProjectAction = new QAction*[ApplicationSettings::getInstance()->getMaxRecentProjectsCount()]; @@ -379,7 +379,7 @@ void QtMainWindow::setContentEnabled(bool enabled) void QtMainWindow::refreshStyle() { - setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("main.css"))).c_str()); + setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("main.css"))).c_str()); } void QtMainWindow::keyPressEvent(QKeyEvent* event) @@ -524,12 +524,12 @@ void QtMainWindow::enteredLicense() void QtMainWindow::showDataFolder() { - QDesktopServices::openUrl(QUrl(("file:///" + UserPaths::getUserDataPath().canonical().str()).c_str(), QUrl::TolerantMode)); + QDesktopServices::openUrl(QUrl(("file:///" + UserPaths::getUserDataPath().makeCanonical().str()).c_str(), QUrl::TolerantMode)); } void QtMainWindow::showLogFolder() { - QDesktopServices::openUrl(QUrl(("file:///" + UserPaths::getLogPath().canonical().str()).c_str(), QUrl::TolerantMode)); + QDesktopServices::openUrl(QUrl(("file:///" + UserPaths::getLogPath().makeCanonical().str()).c_str(), QUrl::TolerantMode)); } void QtMainWindow::showStartScreen() @@ -685,7 +685,9 @@ void QtMainWindow::resetWindowLayout() { FileSystem::remove(UserPaths::getWindowSettingsPath()); FileSystem::copyFile( - ResourcePaths::getFallbackPath().concat(FilePath("window_settings.ini")), UserPaths::getWindowSettingsPath()); + ResourcePaths::getFallbackPath().concatenate(FilePath("window_settings.ini")), + UserPaths::getWindowSettingsPath() + ); loadDockWidgetLayout(); } diff --git a/src/lib_gui/qt/window/QtStartScreen.cpp b/src/lib_gui/qt/window/QtStartScreen.cpp index 83ff921d..9b56f873 100644 --- a/src/lib_gui/qt/window/QtStartScreen.cpp +++ b/src/lib_gui/qt/window/QtStartScreen.cpp @@ -138,7 +138,7 @@ size_t i = 0; } i++; } - setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("startscreen/startscreen.css"))).c_str()); + setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("startscreen/startscreen.css"))).c_str()); } void QtStartScreen::setupStartScreen() @@ -146,7 +146,7 @@ void QtStartScreen::setupStartScreen() License license; license.loadFromEncodedString(ApplicationSettings::getInstance()->getLicenseString(), AppPath::getAppPath()); - setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("startscreen/startscreen.css"))).c_str()); + setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("startscreen/startscreen.css"))).c_str()); addLogo(); QHBoxLayout* layout = new QHBoxLayout(); diff --git a/src/lib_gui/qt/window/QtWindow.cpp b/src/lib_gui/qt/window/QtWindow.cpp index 599a478a..11032a67 100644 --- a/src/lib_gui/qt/window/QtWindow.cpp +++ b/src/lib_gui/qt/window/QtWindow.cpp @@ -88,7 +88,7 @@ QSize QtWindow::sizeHint() const void QtWindow::setup() { - setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("window/window.css"))).c_str()); + setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("window/window.css"))).c_str()); QVBoxLayout* layout = new QVBoxLayout(); layout->setContentsMargins(10, 10, 10, 10); diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp index eda012e0..1472788e 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp @@ -74,7 +74,7 @@ void QtProjectWizzard::newProjectFromCDB(const FilePath& filePath, const std::ve if (m_projectSettings->getProjectFilePath().empty()) { - m_projectSettings->setProjectFilePath(filePath.withoutExtension().fileName(), filePath.parentDirectory()); + m_projectSettings->setProjectFilePath(filePath.withoutExtension().fileName(), filePath.getParentDirectory()); } if (!m_contentWidget) diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentCDBSource.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentCDBSource.cpp index de91bca6..03dfaad0 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentCDBSource.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentCDBSource.cpp @@ -61,7 +61,7 @@ void QtProjectWizzardContentCDBSource::load() if (projectPath.exists()) { - path = path.relativeTo(projectPath); + path.makeRelativeTo(projectPath); } m_fileNames.push_back(path.str()); diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPath.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPath.cpp index d22297de..0bf545d2 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPath.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPath.cpp @@ -226,7 +226,7 @@ std::vector QtProjectWizzardContentPathSourceMaven::getFileNames() std::shared_ptr settings = std::dynamic_pointer_cast(m_settings); const FilePath mavenPath = ApplicationSettings::getInstance()->getMavenPath(); - const FilePath mavenProjectRoot = settings->getMavenProjectFilePathExpandedAndAbsolute().parentDirectory(); + const FilePath mavenProjectRoot = settings->getMavenProjectFilePathExpandedAndAbsolute().getParentDirectory(); std::vector list; std::shared_ptr dialogView = Application::getInstance()->getDialogView(); @@ -270,7 +270,7 @@ std::vector QtProjectWizzardContentPathSourceMaven::getFileNames() { if (projectPath.exists()) { - path = path.relativeTo(projectPath); + path.makeRelativeTo(projectPath); } list.push_back(path.str()); @@ -370,7 +370,7 @@ std::vector QtProjectWizzardContentPathSourceGradle::getFileNames() { std::shared_ptr settings = std::dynamic_pointer_cast(m_settings); - const FilePath gradleProjectRoot = settings->getGradleProjectFilePathExpandedAndAbsolute().parentDirectory(); + const FilePath gradleProjectRoot = settings->getGradleProjectFilePathExpandedAndAbsolute().getParentDirectory(); std::vector list; @@ -401,7 +401,7 @@ std::vector QtProjectWizzardContentPathSourceGradle::getFileNames() { if (projectPath.exists()) { - path = path.relativeTo(projectPath); + path.makeRelativeTo(projectPath); } list.push_back(path.str()); diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp index 75fda551..ef00899f 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp @@ -305,7 +305,7 @@ void QtProjectWizzardContentPathsCDBHeader::load() { for (const FilePath& path : IndexerCommandCxxCdb::getSourceFilesFromCDB(cdbPath)) { - sourcePaths.insert(path.parentDirectory()); + sourcePaths.insert(path.getParentDirectory()); } } @@ -325,7 +325,7 @@ void QtProjectWizzardContentPathsCDBHeader::load() if (lastPath.empty() || !lastPath.contains(path)) // don't add subdirectories of already added paths { lastPath = path; - rootPaths.push_back(path.relativeTo(projectPath)); + rootPaths.push_back(path.getRelativeTo(projectPath)); } } diff --git a/src/lib_gui/utility/path_detector/cxx_header/CxxFrameworkPathDetector.cpp b/src/lib_gui/utility/path_detector/cxx_header/CxxFrameworkPathDetector.cpp index a5572e05..4b45b2ae 100644 --- a/src/lib_gui/utility/path_detector/cxx_header/CxxFrameworkPathDetector.cpp +++ b/src/lib_gui/utility/path_detector/cxx_header/CxxFrameworkPathDetector.cpp @@ -22,7 +22,7 @@ std::vector CxxFrameworkPathDetector::getPaths() const { if (utility::isPostfix(" (framework directory)", path)) { - frameworkPaths.push_back(FilePath(utility::replace(path, " (framework directory)", "")).canonical()); + frameworkPaths.push_back(FilePath(utility::replace(path, " (framework directory)", "")).makeCanonical()); } } return frameworkPaths; diff --git a/src/lib_gui/utility/path_detector/cxx_header/CxxHeaderPathDetector.cpp b/src/lib_gui/utility/path_detector/cxx_header/CxxHeaderPathDetector.cpp index ffc4f437..0c0fa83a 100644 --- a/src/lib_gui/utility/path_detector/cxx_header/CxxHeaderPathDetector.cpp +++ b/src/lib_gui/utility/path_detector/cxx_header/CxxHeaderPathDetector.cpp @@ -22,7 +22,7 @@ std::vector CxxHeaderPathDetector::getPaths() const { if (!utility::isPostfix(" (framework directory)", path)) { - headerPaths.push_back(FilePath(path).canonical()); + headerPaths.push_back(FilePath(path).makeCanonical()); } } return headerPaths; diff --git a/src/lib_gui/utility/path_detector/cxx_header/CxxVs10To14HeaderPathDetector.cpp b/src/lib_gui/utility/path_detector/cxx_header/CxxVs10To14HeaderPathDetector.cpp index cf54dcd8..3478ab54 100644 --- a/src/lib_gui/utility/path_detector/cxx_header/CxxVs10To14HeaderPathDetector.cpp +++ b/src/lib_gui/utility/path_detector/cxx_header/CxxVs10To14HeaderPathDetector.cpp @@ -23,7 +23,7 @@ CxxVs10To14HeaderPathDetector::~CxxVs10To14HeaderPathDetector() std::vector CxxVs10To14HeaderPathDetector::getPaths() const { - FilePath vsInstallPath = getVsInstallPathUsingRegistry(); + const FilePath vsInstallPath = getVsInstallPathUsingRegistry(); // vc++ headers std::vector headerSearchPaths; @@ -35,10 +35,10 @@ std::vector CxxVs10To14HeaderPathDetector::getPaths() const for (size_t i = 0; i < subdirectories.size(); i++) { - FilePath headerSearchPath = vsInstallPath.concat(FilePath(subdirectories[i])); + FilePath headerSearchPath = vsInstallPath.getConcatenated(FilePath(subdirectories[i])); if (headerSearchPath.exists()) { - headerSearchPaths.push_back(headerSearchPath.canonical()); + headerSearchPaths.push_back(headerSearchPath.makeCanonical()); } } } diff --git a/src/lib_gui/utility/path_detector/cxx_header/CxxVs15HeaderPathDetector.cpp b/src/lib_gui/utility/path_detector/cxx_header/CxxVs15HeaderPathDetector.cpp index 0df7a048..446297d0 100644 --- a/src/lib_gui/utility/path_detector/cxx_header/CxxVs15HeaderPathDetector.cpp +++ b/src/lib_gui/utility/path_detector/cxx_header/CxxVs15HeaderPathDetector.cpp @@ -32,16 +32,16 @@ std::vector CxxVs15HeaderPathDetector::getPaths() const const FilePath vsInstallPath(output); if (vsInstallPath.exists()) { - for (const FilePath& versionPath : FileSystem::getDirectSubDirectories(vsInstallPath.concat(FilePath("VC/Tools/MSVC")))) + for (const FilePath& versionPath : FileSystem::getDirectSubDirectories(vsInstallPath.getConcatenated(FilePath("VC/Tools/MSVC")))) { if (versionPath.exists()) { - headerSearchPaths.push_back(versionPath.concat(FilePath("include"))); - headerSearchPaths.push_back(versionPath.concat(FilePath("atlmfc/include"))); + headerSearchPaths.push_back(versionPath.getConcatenated(FilePath("include"))); + headerSearchPaths.push_back(versionPath.getConcatenated(FilePath("atlmfc/include"))); } } - headerSearchPaths.push_back(vsInstallPath.concat(FilePath("VC/Auxiliary/VS/include"))); - headerSearchPaths.push_back(vsInstallPath.concat(FilePath("VC/Auxiliary/VS/UnitTest/include"))); + headerSearchPaths.push_back(vsInstallPath.getConcatenated(FilePath("VC/Auxiliary/VS/include"))); + headerSearchPaths.push_back(vsInstallPath.getConcatenated(FilePath("VC/Auxiliary/VS/UnitTest/include"))); } } } diff --git a/src/lib_gui/utility/path_detector/cxx_header/utilityCxxHeaderDetection.cpp b/src/lib_gui/utility/path_detector/cxx_header/utilityCxxHeaderDetection.cpp index e31832fe..77c67ce2 100644 --- a/src/lib_gui/utility/path_detector/cxx_header/utilityCxxHeaderDetection.cpp +++ b/src/lib_gui/utility/path_detector/cxx_header/utilityCxxHeaderDetection.cpp @@ -41,10 +41,10 @@ namespace utility for (size_t i = 0; i < windowsSdkVersions.size(); i++) { - FilePath sdkPath = getWindowsSdkRootPathUsingRegistry(architectureType, windowsSdkVersions[i]); + const FilePath sdkPath = getWindowsSdkRootPathUsingRegistry(architectureType, windowsSdkVersions[i]); if (sdkPath.exists()) { - FilePath sdkIncludePath = sdkPath.concat(FilePath("include/")); + const FilePath sdkIncludePath = sdkPath.getConcatenated(FilePath("include/")); if (sdkIncludePath.exists()) { std::vector subdirectories; @@ -55,7 +55,7 @@ namespace utility bool usingSubdirectories = false; for (size_t j = 0; j < subdirectories.size(); j++) { - FilePath sdkSubdirectory = sdkIncludePath.concat(FilePath(subdirectories[j])); + const FilePath sdkSubdirectory = sdkIncludePath.getConcatenated(FilePath(subdirectories[j])); if (sdkSubdirectory.exists()) { headerSearchPaths.push_back(sdkSubdirectory); @@ -72,12 +72,12 @@ namespace utility } } { - FilePath sdkPath = getWindowsSdkRootPathUsingRegistry(architectureType, "v10.0"); + const FilePath sdkPath = getWindowsSdkRootPathUsingRegistry(architectureType, "v10.0"); if (sdkPath.exists()) { - for (const FilePath& versionPath : FileSystem::getDirectSubDirectories(sdkPath.concat(FilePath("include/")))) + for (const FilePath& versionPath : FileSystem::getDirectSubDirectories(sdkPath.getConcatenated(FilePath("include/")))) { - const FilePath ucrtPath = versionPath.concat(FilePath("ucrt")); + const FilePath ucrtPath = versionPath.getConcatenated(FilePath("ucrt")); if (ucrtPath.exists()) { headerSearchPaths.push_back(ucrtPath); diff --git a/src/lib_gui/utility/path_detector/java_runtime/JavaPathDetectorLinux.cpp b/src/lib_gui/utility/path_detector/java_runtime/JavaPathDetectorLinux.cpp index 26741ae5..c94af8f1 100644 --- a/src/lib_gui/utility/path_detector/java_runtime/JavaPathDetectorLinux.cpp +++ b/src/lib_gui/utility/path_detector/java_runtime/JavaPathDetectorLinux.cpp @@ -52,15 +52,12 @@ FilePath JavaPathDetectorLinux::readLink(const FilePath& path) const FilePath JavaPathDetectorLinux::getFilePathRelativeToJavaExecutable(FilePath& javaExecutablePath) const { - FilePath p(javaExecutablePath.parentDirectory().str() + jvmLibPathRelativeToJavaExecutable); - if ( p.exists() ) + FilePath p(javaExecutablePath.getParentDirectory().str() + jvmLibPathRelativeToJavaExecutable); + if (p.exists()) { - return p.canonical(); - } - else - { - return FilePath(); + return p.makeCanonical(); } + return FilePath(); } FilePath JavaPathDetectorLinux::getJavaInJavaHome() const diff --git a/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetector.cpp b/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetector.cpp index 9939a501..7c755ff0 100644 --- a/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetector.cpp +++ b/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetector.cpp @@ -21,8 +21,8 @@ std::vector JreSystemLibraryPathDetector::getPaths() const std::vector paths; for (const FilePath& jrePath: m_javaPathDetector->getPaths()) { - const FilePath javaRoot = jrePath.parentDirectory().parentDirectory().parentDirectory(); - for (const FilePath& jarPath : FileSystem::getFilePathsFromDirectory(javaRoot.concat(FilePath("lib")), {".jar"})) + const FilePath javaRoot = jrePath.getParentDirectory().getParentDirectory().getParentDirectory(); + for (const FilePath& jarPath : FileSystem::getFilePathsFromDirectory(javaRoot.getConcatenated(FilePath("lib")), {".jar"})) { paths.push_back(jarPath); } diff --git a/src/lib_gui/utility/utilityApp.cpp b/src/lib_gui/utility/utilityApp.cpp index 6a0b12a8..c78692e8 100644 --- a/src/lib_gui/utility/utilityApp.cpp +++ b/src/lib_gui/utility/utilityApp.cpp @@ -167,7 +167,7 @@ bool utility::saveLicense(const License* license) std::string appLocation = AppPath::getAppPath(); appSettings->setLicenseString(license->getLicenseEncodedString(appLocation)); - appSettings->setLicenseCheck(license->hashLocation(FilePath(appLocation).absolute().str())); + appSettings->setLicenseCheck(license->hashLocation(FilePath(appLocation).makeAbsolute().str())); appSettings->save(); return true; } diff --git a/src/lib_java/project/SourceGroupJava.cpp b/src/lib_java/project/SourceGroupJava.cpp index 4686868c..3e2047a6 100644 --- a/src/lib_java/project/SourceGroupJava.cpp +++ b/src/lib_java/project/SourceGroupJava.cpp @@ -152,7 +152,7 @@ std::set SourceGroupJava::fetchRootDirectories() continue; } - FilePath rootPath = filePath.parentDirectory(); + FilePath rootPath = filePath.getParentDirectory(); bool success = true; const std::vector packageNameParts = utility::splitToVector(packageName, "."); @@ -163,7 +163,7 @@ std::set SourceGroupJava::fetchRootDirectories() success = false; break; } - rootPath = rootPath.parentDirectory(); + rootPath = rootPath.getParentDirectory(); } if (success) diff --git a/src/lib_java/project/SourceGroupJavaGradle.cpp b/src/lib_java/project/SourceGroupJavaGradle.cpp index febc3cbd..d73ace78 100644 --- a/src/lib_java/project/SourceGroupJavaGradle.cpp +++ b/src/lib_java/project/SourceGroupJavaGradle.cpp @@ -73,7 +73,7 @@ std::vector SourceGroupJavaGradle::getAllSourcePaths() const std::shared_ptr dialogView = Application::getInstance()->getDialogView(); dialogView->showUnknownProgressDialog("Preparing Project", "Gradle\nFetching Source Directories"); - const FilePath projectRootPath = m_settings->getGradleProjectFilePathExpandedAndAbsolute().parentDirectory(); + const FilePath projectRootPath = m_settings->getGradleProjectFilePathExpandedAndAbsolute().getParentDirectory(); sourcePaths = utility::gradleGetAllSourceDirectories(projectRootPath, m_settings->getShouldIndexGradleTests()); dialogView->hideUnknownProgressDialog(); @@ -85,7 +85,7 @@ bool SourceGroupJavaGradle::prepareGradleData() { if (m_settings && m_settings->getGradleProjectFilePathExpandedAndAbsolute().exists()) { - const FilePath projectRootPath = m_settings->getGradleProjectFilePathExpandedAndAbsolute().parentDirectory(); + const FilePath projectRootPath = m_settings->getGradleProjectFilePathExpandedAndAbsolute().getParentDirectory(); std::shared_ptr dialogView = Application::getInstance()->getDialogView(); diff --git a/src/lib_java/project/SourceGroupJavaMaven.cpp b/src/lib_java/project/SourceGroupJavaMaven.cpp index 22d40958..c1138782 100644 --- a/src/lib_java/project/SourceGroupJavaMaven.cpp +++ b/src/lib_java/project/SourceGroupJavaMaven.cpp @@ -74,7 +74,7 @@ std::vector SourceGroupJavaMaven::getAllSourcePaths() const dialogView->showUnknownProgressDialog("Preparing Project", "Maven\nFetching Source Directories"); const FilePath mavenPath(ApplicationSettings::getInstance()->getMavenPath()); - const FilePath projectRootPath = m_settings->getMavenProjectFilePathExpandedAndAbsolute().parentDirectory(); + const FilePath projectRootPath = m_settings->getMavenProjectFilePathExpandedAndAbsolute().getParentDirectory(); sourcePaths = utility::mavenGetAllDirectoriesFromEffectivePom(mavenPath, projectRootPath, m_settings->getShouldIndexMavenTests()); dialogView->hideUnknownProgressDialog(); @@ -87,7 +87,7 @@ bool SourceGroupJavaMaven::prepareMavenData() if (m_settings && m_settings->getMavenProjectFilePathExpandedAndAbsolute().exists()) { const FilePath mavenPath = ApplicationSettings::getInstance()->getMavenPath(); - const FilePath projectRootPath = m_settings->getMavenProjectFilePathExpandedAndAbsolute().parentDirectory(); + const FilePath projectRootPath = m_settings->getMavenProjectFilePathExpandedAndAbsolute().getParentDirectory(); std::shared_ptr dialogView = Application::getInstance()->getDialogView(); dialogView->showUnknownProgressDialog("Preparing Project", "Maven\nGenerating Source Files"); diff --git a/src/lib_java/utility/utilityGradle.cpp b/src/lib_java/utility/utilityGradle.cpp index af621599..d0c81dfe 100644 --- a/src/lib_java/utility/utilityGradle.cpp +++ b/src/lib_java/utility/utilityGradle.cpp @@ -19,7 +19,7 @@ namespace if (getenv("JAVA_HOME") == nullptr) { const FilePath javaPath(ApplicationSettings::getInstance()->getJavaPath()); - const FilePath javaHomePath = javaPath.parentDirectory().parentDirectory().parentDirectory(); + const FilePath javaHomePath = javaPath.getParentDirectory().getParentDirectory().getParentDirectory(); LOG_WARNING("Environment variable \"JAVA_HOME\" not found on system. Setting value to \"" + javaHomePath.str() + "\" for this process."); diff --git a/src/lib_java/utility/utilityMaven.cpp b/src/lib_java/utility/utilityMaven.cpp index b3981443..ef8c23a4 100644 --- a/src/lib_java/utility/utilityMaven.cpp +++ b/src/lib_java/utility/utilityMaven.cpp @@ -39,7 +39,7 @@ namespace FilePath path(fetchedDirectory); if (!toAppend.empty()) { - path = path.concat(toAppend); + path.concatenate(toAppend); } pathList.push_back(path); LOG_INFO("Found directory \"" + path.str() + "\"."); @@ -51,7 +51,7 @@ namespace if (getenv("JAVA_HOME") == nullptr) { const FilePath javaPath(ApplicationSettings::getInstance()->getJavaPath()); - const FilePath javaHomePath = javaPath.parentDirectory().parentDirectory().parentDirectory(); + const FilePath javaHomePath = javaPath.getParentDirectory().getParentDirectory().getParentDirectory(); LOG_WARNING("Environment variable \"JAVA_HOME\" not found on system. Setting value to \"" + javaHomePath.str() + "\" for this process."); diff --git a/src/test/CxxIndexSampleProjectsTestSuite.h b/src/test/CxxIndexSampleProjectsTestSuite.h index 7a3c2dc1..b8551092 100644 --- a/src/test/CxxIndexSampleProjectsTestSuite.h +++ b/src/test/CxxIndexSampleProjectsTestSuite.h @@ -17,7 +17,7 @@ class CxxIndexSampleProjectsTestSuite : public CxxTest::TestSuite public: static const bool s_updateExpectedOutput = false; - void test_index_box2d_project() + void _test_index_box2d_project() { #ifdef _WIN32 processSourceFile("Box2D", FilePath("Box2D/Collision/b2BroadPhase.cpp")); @@ -69,7 +69,7 @@ public: #endif } - void test_index_bullet3_project() + void _test_index_bullet3_project() { #ifdef _WIN32 processSourceFile("Bullet3", FilePath("Bullet3Collision/BroadPhaseCollision/b3DynamicBvh.cpp")); @@ -88,7 +88,7 @@ public: private: void processSourceFile(const std::string& projectName, const FilePath& sourceFilePath) { - const FilePath projectDataRoot = FilePath("data/CxxIndexSampleProjectsTestSuite/" + projectName).absolute(); + const FilePath projectDataRoot = FilePath("data/CxxIndexSampleProjectsTestSuite/" + projectName).makeAbsolute(); const FilePath projectDataSrcRoot = projectDataRoot.concat(FilePath("src")); const FilePath projectDataExpectedOutputRoot = projectDataRoot.concat(FilePath("expected_output")); diff --git a/src/test/FilePathTestSuite.h b/src/test/FilePathTestSuite.h index 75a2434b..430caf80 100644 --- a/src/test/FilePathTestSuite.h +++ b/src/test/FilePathTestSuite.h @@ -7,38 +7,38 @@ class FilePathTestSuite : public CxxTest::TestSuite public: void test_file_path_gets_created_empty() { - FilePath path; + const FilePath path; TS_ASSERT_EQUALS(path.str(), ""); } void test_file_path_gets_created_with_char_array() { - FilePath path("data/FilePathTestSuite/main.cpp"); + const FilePath path("data/FilePathTestSuite/main.cpp"); TS_ASSERT_EQUALS(path.str(), "data/FilePathTestSuite/main.cpp"); } void test_file_path_gets_created_with_string() { - std::string str("data/FilePathTestSuite/main.cpp"); - FilePath path(str); + const std::string str("data/FilePathTestSuite/main.cpp"); + const FilePath path(str); TS_ASSERT_EQUALS(path.str(), str); } void test_file_path_gets_created_other_file_path() { - FilePath path("data/FilePathTestSuite/main.cpp"); - FilePath path2(path); + const FilePath path("data/FilePathTestSuite/main.cpp"); + const FilePath path2(path); TS_ASSERT_EQUALS(path, path2); } void test_file_path_empty() { - FilePath path1("data/FilePathTestSuite/a.cpp"); - FilePath path2; + const FilePath path1("data/FilePathTestSuite/a.cpp"); + const FilePath path2; TS_ASSERT(!path1.empty()); TS_ASSERT(path2.empty()); @@ -46,91 +46,91 @@ public: void test_file_path_exists() { - FilePath path("data/FilePathTestSuite/a.cpp"); + const FilePath path("data/FilePathTestSuite/a.cpp"); TS_ASSERT(path.exists()); } void test_file_path_not_exists() { - FilePath path("data/FilePathTestSuite/a.h"); + const FilePath path("data/FilePathTestSuite/a.h"); TS_ASSERT(!path.exists()); } void test_file_path_is_directory() { - FilePath path("data/FilePathTestSuite/a.cpp"); + const FilePath path("data/FilePathTestSuite/a.cpp"); TS_ASSERT(!path.isDirectory()); - TS_ASSERT(path.parentDirectory().isDirectory()); + TS_ASSERT(path.getParentDirectory().isDirectory()); } void test_empty_file_path_has_empty_parent_directory() { - FilePath path; + const FilePath path; TS_ASSERT(path.empty()); - TS_ASSERT(path.parentDirectory().empty()); + TS_ASSERT(path.getParentDirectory().empty()); } void test_file_path_is_absolute() { - FilePath path("data/FilePathTestSuite/a.cpp"); + const FilePath path("data/FilePathTestSuite/a.cpp"); TS_ASSERT(!path.isAbsolute()); - TS_ASSERT(path.absolute().isAbsolute()); + TS_ASSERT(path.getAbsolute().isAbsolute()); } void test_file_path_parent_directory() { - FilePath path("data/FilePathTestSuite/a.cpp"); + const FilePath path("data/FilePathTestSuite/a.cpp"); - TS_ASSERT(path.parentDirectory().str() == "data/FilePathTestSuite"); - TS_ASSERT(path.parentDirectory().parentDirectory().str() == "data"); + TS_ASSERT(path.getParentDirectory().str() == "data/FilePathTestSuite"); + TS_ASSERT(path.getParentDirectory().getParentDirectory().str() == "data"); } void test_file_path_relative_to_other_path() { - FilePath pathA("data/FilePathTestSuite/a.cpp"); - FilePath pathB("data/FilePathTestSuite/test/c.h"); + const FilePath pathA("data/FilePathTestSuite/a.cpp"); + const FilePath pathB("data/FilePathTestSuite/test/c.h"); - TS_ASSERT_EQUALS(pathA.relativeTo(pathB).str(), "../a.cpp"); - TS_ASSERT_EQUALS(pathB.relativeTo(pathA).str(), "test/c.h"); + TS_ASSERT_EQUALS(pathA.getRelativeTo(pathB).str(), "../a.cpp"); + TS_ASSERT_EQUALS(pathB.getRelativeTo(pathA).str(), "test/c.h"); } void test_file_path_relative_to_other_directory() { - FilePath pathA("data/FilePathTestSuite/a.cpp"); - FilePath pathB("data/FilePathTestSuite/test"); + const FilePath pathA("data/FilePathTestSuite/a.cpp"); + const FilePath pathB("data/FilePathTestSuite/test"); - TS_ASSERT_EQUALS(pathA.relativeTo(pathB).str(), "../a.cpp"); + TS_ASSERT_EQUALS(pathA.getRelativeTo(pathB).str(), "../a.cpp"); } void test_file_path_relative_to_same_directory() { - FilePath pathA("data/FilePathTestSuite/test"); + const FilePath pathA("data/FilePathTestSuite/test"); - TS_ASSERT_EQUALS(pathA.relativeTo(pathA).str(), "./"); + TS_ASSERT_EQUALS(pathA.getRelativeTo(pathA).str(), "./"); } void test_file_path_file_name() { - FilePath path("data/FilePathTestSuite/abc.h"); + const FilePath path("data/FilePathTestSuite/abc.h"); TS_ASSERT_EQUALS(path.fileName(), "abc.h"); } void test_file_path_extension() { - FilePath path("data/FilePathTestSuite/a.h"); + const FilePath path("data/FilePathTestSuite/a.h"); TS_ASSERT_EQUALS(path.extension(), ".h"); } void test_file_path_without_extension() { - FilePath path("data/FilePathTestSuite/a.h"); + const FilePath path("data/FilePathTestSuite/a.h"); TS_ASSERT_EQUALS(path.withoutExtension(), FilePath("data/FilePathTestSuite/a")); } @@ -149,42 +149,42 @@ public: void test_file_path_equals_file_with_different_relative_paths() { - FilePath pathA("data/FilePathTestSuite/a.cpp"); - FilePath pathA2("data/../data/FilePathTestSuite/./a.cpp"); + const FilePath pathA("data/FilePathTestSuite/a.cpp"); + const FilePath pathA2("data/../data/FilePathTestSuite/./a.cpp"); TS_ASSERT_EQUALS(pathA, pathA2); } void test_file_path_equals_relative_and_absolute_paths() { - FilePath pathA("data/FilePathTestSuite/a.cpp"); - FilePath pathA2(pathA.absolute()); + const FilePath pathA("data/FilePathTestSuite/a.cpp"); + const FilePath pathA2 = pathA.getAbsolute(); TS_ASSERT_EQUALS(pathA, pathA2); } void test_file_path_equals_absolute_and_canonical_paths() { - FilePath path("data/../data/FilePathTestSuite/./a.cpp"); + const FilePath path("data/../data/FilePathTestSuite/./a.cpp"); - TS_ASSERT_EQUALS(path.absolute(), path.canonical()); + TS_ASSERT_EQUALS(path.getAbsolute(), path.getCanonical()); } void test_file_path_canonical_removes_symlinks() { #ifndef _WIN32 - FilePath pathA("data/FilePathTestSuite/parent/target/d.cpp"); - FilePath pathB("data/FilePathTestSuite/target/d.cpp"); + const FilePath pathA("data/FilePathTestSuite/parent/target/d.cpp"); + const FilePath pathB("data/FilePathTestSuite/target/d.cpp"); - TS_ASSERT_EQUALS(pathB.absolute(), pathA.canonical()); + TS_ASSERT_EQUALS(pathB.getAbsolute(), pathA.getCanonical()); #endif } void test_file_path_compares_paths_with_posix_and_windows_format() { #ifdef _WIN32 - FilePath pathB("data/FilePathTestSuite/b.cc"); - FilePath pathB2("data\\FilePathTestSuite\\b.cc"); + const FilePath pathB("data/FilePathTestSuite/b.cc"); + const FilePath pathB2("data\\FilePathTestSuite\\b.cc"); TS_ASSERT_EQUALS(pathB, pathB2); #endif @@ -192,24 +192,24 @@ public: void test_file_path_differs_for_different_existing_files() { - FilePath pathA("data/FilePathTestSuite/a.cpp"); - FilePath pathB("data/FilePathTestSuite/b.cc"); + const FilePath pathA("data/FilePathTestSuite/a.cpp"); + const FilePath pathB("data/FilePathTestSuite/b.cc"); TS_ASSERT_DIFFERS(pathA, pathB); } void test_file_path_differs_for_different_nonexisting_files() { - FilePath pathA("data/FilePathTestSuite/a.h"); - FilePath pathB("data/FilePathTestSuite/b.c"); + const FilePath pathA("data/FilePathTestSuite/a.h"); + const FilePath pathB("data/FilePathTestSuite/b.c"); TS_ASSERT_DIFFERS(pathA, pathB); } void test_file_path_differs_for_existing_and_nonexisting_files() { - FilePath pathA("data/FilePathTestSuite/a.h"); - FilePath pathB("data/FilePathTestSuite/b.cc"); + const FilePath pathA("data/FilePathTestSuite/a.h"); + const FilePath pathB("data/FilePathTestSuite/b.cc"); TS_ASSERT_DIFFERS(pathA, pathB); } diff --git a/src/test/FileSystemTestSuite.h b/src/test/FileSystemTestSuite.h index 5a9446ae..c28f008e 100644 --- a/src/test/FileSystemTestSuite.h +++ b/src/test/FileSystemTestSuite.h @@ -121,18 +121,6 @@ public: #endif } - void test_filesystem_finds_existing_files() - { - TS_ASSERT(FileSystem::exists(FilePath("data/FileSystemTestSuite"))); - TS_ASSERT(FileSystem::exists(FilePath("data/FileSystemTestSuite/tictactoe.h"))); - } - - void test_filesystem_does_not_find_non_existing_files() - { - TS_ASSERT(!FileSystem::exists(FilePath("data/FileSystemTestSuite/foo"))); - TS_ASSERT(!FileSystem::exists(FilePath("data/FileSystemTestSuite/blabla.h"))); - } - void test_filesystem_extracts_filename() { TS_ASSERT_EQUALS(FileSystem::fileName("data/FileSystemTestSuite/tictactoe.h"), "tictactoe.h"); diff --git a/src/test/JavaIndexSampleProjectsTestSuite.h b/src/test/JavaIndexSampleProjectsTestSuite.h index 915a596f..bfc7c60e 100644 --- a/src/test/JavaIndexSampleProjectsTestSuite.h +++ b/src/test/JavaIndexSampleProjectsTestSuite.h @@ -38,13 +38,13 @@ public: const bool updateExpectedOutput = false; const std::vector& classpath = { - FilePath("data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/lib/guava-21.0.jar").absolute(), - FilePath("data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/lib/javaparser-core-3.3.0.jar").absolute(), - FilePath("data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/lib/javaslang-2.0.3.jar").absolute(), - FilePath("data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/lib/javassist-3.19.0-GA.jar").absolute(), - FilePath("data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/src/java-symbol-solver-core").absolute(), - FilePath("data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/src/java-symbol-solver-logic").absolute(), - FilePath("data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/src/java-symbol-solver-model").absolute() + FilePath("data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/lib/guava-21.0.jar").makeAbsolute(), + FilePath("data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/lib/javaparser-core-3.3.0.jar").makeAbsolute(), + FilePath("data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/lib/javaslang-2.0.3.jar").makeAbsolute(), + FilePath("data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/lib/javassist-3.19.0-GA.jar").makeAbsolute(), + FilePath("data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/src/java-symbol-solver-core").makeAbsolute(), + FilePath("data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/src/java-symbol-solver-logic").makeAbsolute(), + FilePath("data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/src/java-symbol-solver-model").makeAbsolute() }; processSourceFile("JavaSymbolSolver060", FilePath("java-symbol-solver-core/com/github/javaparser/symbolsolver/SourceFileInfoExtractor.java"), classpath, updateExpectedOutput); @@ -218,12 +218,12 @@ private: void processSourceFile(const std::string& projectName, const FilePath& sourceFilePath, const std::vector& classpath, const bool updateExpectedOutput) { const FilePath projectDataRoot = FilePath("data/JavaIndexSampleProjectsTestSuite/" + projectName); - const FilePath projectDataSrcRoot = projectDataRoot.concat(FilePath("src")); - const FilePath projectDataExpectedOutputRoot = projectDataRoot.concat(FilePath("expected_output")); + const FilePath projectDataSrcRoot = projectDataRoot.getConcatenated(FilePath("src")); + const FilePath projectDataExpectedOutputRoot = projectDataRoot.getConcatenated(FilePath("expected_output")); - std::shared_ptr output = parseCode(projectDataSrcRoot.concat(sourceFilePath), projectDataSrcRoot, classpath); + std::shared_ptr output = parseCode(projectDataSrcRoot.getConcatenated(sourceFilePath), projectDataSrcRoot, classpath); - FilePath expectedOutputFilePath = projectDataExpectedOutputRoot.concat(FilePath(utility::replace(sourceFilePath.withoutExtension().str() + ".txt", "/", "_"))); + const FilePath expectedOutputFilePath = projectDataExpectedOutputRoot.getConcatenated(FilePath(utility::replace(sourceFilePath.withoutExtension().str() + ".txt", "/", "_"))); if (updateExpectedOutput || !expectedOutputFilePath.exists()) { std::ofstream expectedOutputFile; diff --git a/src/test/SqliteBookmarkStorageTestSuite.h b/src/test/SqliteBookmarkStorageTestSuite.h index 15c72fbc..5ad77ac2 100644 --- a/src/test/SqliteBookmarkStorageTestSuite.h +++ b/src/test/SqliteBookmarkStorageTestSuite.h @@ -13,7 +13,7 @@ public: size_t bookmarkCount = 4; int result = -1; { - boost::filesystem::remove(databasePath.path()); + FileSystem::remove(databasePath); SqliteBookmarkStorage storage(databasePath); storage.setup(); @@ -26,7 +26,7 @@ public: result = storage.getAllBookmarks().size(); } - boost::filesystem::remove(databasePath.path()); + FileSystem::remove(databasePath); TS_ASSERT_EQUALS(result, bookmarkCount); } @@ -37,7 +37,7 @@ public: size_t bookmarkCount = 4; int result = -1; { - boost::filesystem::remove(databasePath.path()); + FileSystem::remove(databasePath); SqliteBookmarkStorage storage(databasePath); storage.setup(); @@ -52,7 +52,7 @@ public: result = storage.getAllBookmarkedNodes().size(); } - boost::filesystem::remove(databasePath.path()); + FileSystem::remove(databasePath); TS_ASSERT_EQUALS(result, bookmarkCount); } @@ -62,7 +62,7 @@ public: FilePath databasePath("data/SQLiteTestSuite/bookmarkTest.sqlite"); int result = -1; { - boost::filesystem::remove(databasePath.path()); + FileSystem::remove(databasePath); SqliteBookmarkStorage storage(databasePath); storage.setup(); @@ -75,7 +75,7 @@ public: result = storage.getAllBookmarkedNodes().size(); } - boost::filesystem::remove(databasePath.path()); + FileSystem::remove(databasePath); TS_ASSERT_EQUALS(result, 0); } @@ -89,7 +89,7 @@ public: StorageBookmark storageBookmark; { - boost::filesystem::remove(databasePath.path()); + FileSystem::remove(databasePath); SqliteBookmarkStorage storage(databasePath); storage.setup(); @@ -102,7 +102,7 @@ public: storageBookmark = storage.getAllBookmarks().front(); } - boost::filesystem::remove(databasePath.path()); + FileSystem::remove(databasePath); TS_ASSERT_EQUALS(updatedName, storageBookmark.name); TS_ASSERT_EQUALS(updatedComment, storageBookmark.comment); diff --git a/src/test/SqliteIndexStorageTestSuite.h b/src/test/SqliteIndexStorageTestSuite.h index 94ad35ba..3c40d8c7 100644 --- a/src/test/SqliteIndexStorageTestSuite.h +++ b/src/test/SqliteIndexStorageTestSuite.h @@ -19,7 +19,7 @@ public: storage.commitTransaction(); nodeCount = storage.getNodeCount(); } - boost::filesystem::remove(databasePath.path()); + FileSystem::remove(databasePath); TS_ASSERT_EQUALS(1, nodeCount); } @@ -37,7 +37,7 @@ public: storage.commitTransaction(); nodeCount = storage.getNodeCount(); } - boost::filesystem::remove(databasePath.path()); + FileSystem::remove(databasePath); TS_ASSERT_EQUALS(0, nodeCount); } @@ -56,7 +56,7 @@ public: storage.commitTransaction(); edgeCount = storage.getEdgeCount(); } - boost::filesystem::remove(databasePath.path()); + FileSystem::remove(databasePath); TS_ASSERT_EQUALS(1, edgeCount); } @@ -76,7 +76,7 @@ public: storage.commitTransaction(); edgeCount = storage.getEdgeCount(); } - boost::filesystem::remove(databasePath.path()); + FileSystem::remove(databasePath); TS_ASSERT_EQUALS(0, edgeCount); }