@@ -773,22 +773,25 @@ func (extraction *Extraction) extractFileInfo(tw *trap.Writer, file string, isDu
773773 var parentLbl trap.Label
774774
775775 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
777780 if i == 0 {
778781 rawPath = component
779782 if component == "" || regexp .MustCompile (`^[A-Za-z]:$` ).MatchString (component ) {
780783 // Handle linux root and Windows drive letters by appending "/"
781- canonicalPath = rawPath + "/"
784+ displayPath = rawPath + "/"
782785 } else {
783- canonicalPath = rawPath
786+ displayPath = rawPath
784787 }
785788 } else {
786789 rawPath = parentPath + "/" + component
787- canonicalPath = rawPath
790+ displayPath = rawPath
788791 }
789792 if i == len (components )- 1 {
790793 lbl := tw .Labeler .FileLabelFor (file )
791- dbscheme .FilesTable .Emit (tw , lbl , canonicalPath )
794+ dbscheme .FilesTable .Emit (tw , lbl , displayPath )
792795 dbscheme .ContainerParentTable .Emit (tw , parentLbl , lbl )
793796 dbscheme .HasLocationTable .Emit (tw , lbl , emitLocation (tw , lbl , 0 , 0 , 0 , 0 ))
794797 extraction .Lock .Lock ()
@@ -799,8 +802,8 @@ func (extraction *Extraction) extractFileInfo(tw *trap.Writer, file string, isDu
799802 extraction .Lock .Unlock ()
800803 break
801804 }
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 )
804807 if i > 0 {
805808 dbscheme .ContainerParentTable .Emit (tw , parentLbl , lbl )
806809 }
0 commit comments