@@ -773,22 +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
+ // displayPath is the same as rawPath except for root directories: if
777
+ // rawPath is "" then displayPath is "/"; if rawPath is "C:" then
778
+ // displayPath is "C:/".
779
+ var rawPath , displayPath string
777
780
if i == 0 {
778
781
rawPath = component
779
782
if component == "" || regexp .MustCompile (`^[A-Za-z]:$` ).MatchString (component ) {
780
783
// Handle linux root and Windows drive letters by appending "/"
781
- canonicalPath = rawPath + "/"
784
+ displayPath = rawPath + "/"
782
785
} else {
783
- canonicalPath = rawPath
786
+ displayPath = rawPath
784
787
}
785
788
} else {
786
789
rawPath = parentPath + "/" + component
787
- canonicalPath = rawPath
790
+ displayPath = rawPath
788
791
}
789
792
if i == len (components )- 1 {
790
793
lbl := tw .Labeler .FileLabelFor (file )
791
- dbscheme .FilesTable .Emit (tw , lbl , canonicalPath )
794
+ dbscheme .FilesTable .Emit (tw , lbl , displayPath )
792
795
dbscheme .ContainerParentTable .Emit (tw , parentLbl , lbl )
793
796
dbscheme .HasLocationTable .Emit (tw , lbl , emitLocation (tw , lbl , 0 , 0 , 0 , 0 ))
794
797
extraction .Lock .Lock ()
@@ -799,8 +802,8 @@ func (extraction *Extraction) extractFileInfo(tw *trap.Writer, file string, isDu
799
802
extraction .Lock .Unlock ()
800
803
break
801
804
}
802
- lbl := tw .Labeler .GlobalID (util .EscapeTrapSpecialChars (canonicalPath ) + ";folder" )
803
- dbscheme .FoldersTable .Emit (tw , lbl , canonicalPath )
805
+ lbl := tw .Labeler .GlobalID (util .EscapeTrapSpecialChars (displayPath ) + ";folder" )
806
+ dbscheme .FoldersTable .Emit (tw , lbl , displayPath )
804
807
if i > 0 {
805
808
dbscheme .ContainerParentTable .Emit (tw , parentLbl , lbl )
806
809
}
0 commit comments