Skip to content

Commit d5044fd

Browse files
committed
Deal better with Windows paths
1 parent 401c606 commit d5044fd

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

go/extractor/extractor.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,9 +773,15 @@ func (extraction *Extraction) extractFileInfo(tw *trap.Writer, file string, isDu
773773
var parentLbl trap.Label
774774

775775
for i, component := range components {
776+
isRoot := false
776777
if i == 0 {
777778
if component == "" {
778779
path = "/"
780+
isRoot = true
781+
} else if regexp.MustCompile(`^[A-Za-z]:$`).MatchString(component) {
782+
// Handle Windows drive letters by appending "/"
783+
path = component + "/"
784+
isRoot = true
779785
} else {
780786
path = component
781787
}
@@ -800,7 +806,7 @@ func (extraction *Extraction) extractFileInfo(tw *trap.Writer, file string, isDu
800806
if i > 0 {
801807
dbscheme.ContainerParentTable.Emit(tw, parentLbl, lbl)
802808
}
803-
if path != "/" {
809+
if !isRoot {
804810
parentPath = path
805811
}
806812
parentLbl = lbl

0 commit comments

Comments
 (0)