@@ -773,24 +773,25 @@ func (extraction *Extraction) extractFileInfo(tw *trap.Writer, file string, isDu
773
773
var parentLbl trap.Label
774
774
775
775
for i , component := range components {
776
+ var rawPath , canonicalPath string
776
777
isRoot := false
777
778
if i == 0 {
778
- if component == "" {
779
- path = "/"
780
- isRoot = true
781
- } else if regexp .MustCompile (`^[A-Za-z]:$` ).MatchString (component ) {
782
- // Handle Windows drive letters by appending "/"
783
- path = component + "/"
779
+ rawPath = component
780
+ if component == "" || regexp .MustCompile (`^[A-Za-z]:$` ).MatchString (component ) {
781
+ // Handle linux root and Windows drive letters by appending "/"
782
+ canonicalPath = rawPath + "/"
784
783
isRoot = true
785
784
} else {
786
- path = component
785
+ canonicalPath = rawPath
787
786
}
787
+
788
788
} else {
789
789
path = parentPath + "/" + component
790
+ canonicalPath = rawPath
790
791
}
791
792
if i == len (components )- 1 {
792
793
lbl := tw .Labeler .FileLabelFor (file )
793
- dbscheme .FilesTable .Emit (tw , lbl , path )
794
+ dbscheme .FilesTable .Emit (tw , lbl , canonicalPath )
794
795
dbscheme .ContainerParentTable .Emit (tw , parentLbl , lbl )
795
796
dbscheme .HasLocationTable .Emit (tw , lbl , emitLocation (tw , lbl , 0 , 0 , 0 , 0 ))
796
797
extraction .Lock .Lock ()
@@ -801,14 +802,12 @@ func (extraction *Extraction) extractFileInfo(tw *trap.Writer, file string, isDu
801
802
extraction .Lock .Unlock ()
802
803
break
803
804
}
804
- lbl := tw .Labeler .GlobalID (util .EscapeTrapSpecialChars (path ) + ";folder" )
805
- dbscheme .FoldersTable .Emit (tw , lbl , path )
805
+ lbl := tw .Labeler .GlobalID (util .EscapeTrapSpecialChars (canonicalPath ) + ";folder" )
806
+ dbscheme .FoldersTable .Emit (tw , lbl , canonicalPath )
806
807
if i > 0 {
807
808
dbscheme .ContainerParentTable .Emit (tw , parentLbl , lbl )
808
809
}
809
- if ! isRoot {
810
- parentPath = path
811
- }
810
+ parentPath = rawPath
812
811
parentLbl = lbl
813
812
}
814
813
}
0 commit comments