Skip to content
This repository was archived by the owner on Oct 15, 2020. It is now read-only.

Commit 1ec501b

Browse files
authored
Store absolute paths in FILE nodes. (#136)
1 parent b859267 commit 1ec501b

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/main/scala/io/shiftleft/fuzzyc2cpg/FuzzyC2Cpg.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class FuzzyC2Cpg(outputModuleFactory: CpgOutputModuleFactory) {
117117

118118
def createFileNode(pathToFile: Path): Node = {
119119
newNode(NodeType.FILE)
120-
.addStringProperty(NodePropertyName.NAME, pathToFile.toString)
120+
.addStringProperty(NodePropertyName.NAME, pathToFile.toAbsolutePath.toString)
121121
.build()
122122
}
123123

src/test/scala/io/shiftleft/fuzzyc2cpg/ProgramStructureTests.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ class ProgramStructureTests extends WordSpec with Matchers {
2525
.value(NodeKeys.NAME)
2626
.headOption
2727
fileName.isDefined shouldBe true
28-
fileName.head shouldBe "src/test/resources/testcode/structure/structure.c"
28+
fileName.head should not be "src/test/resources/testcode/structure/structure.c"
29+
fileName.head should endWith("src/test/resources/testcode/structure/structure.c")
2930
}
3031

3132
"contain AST edge from file node to namespace block" in {

0 commit comments

Comments
 (0)