mirror of
https://github.com/vbatts/go-mtree.git
synced 2025-07-03 22:28:29 +00:00
vis: adding a pure golang Vis()
The current Vis() and Unvis() are using the C implementation from MTREE(8). But that means that cgo is used, which is not always desired. Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
e42c679e89
commit
08b1000418
19 changed files with 580 additions and 61 deletions
4
tar.go
4
tar.go
|
@ -128,7 +128,7 @@ hdrloop:
|
|||
return
|
||||
}
|
||||
// Alright, it's either file or directory
|
||||
encodedName, err := Vis(filepath.Base(hdr.Name))
|
||||
encodedName, err := Vis(filepath.Base(hdr.Name), DefaultVisFlags)
|
||||
if err != nil {
|
||||
tmpFile.Close()
|
||||
os.Remove(tmpFile.Name())
|
||||
|
@ -248,7 +248,7 @@ func populateTree(root, e *Entry, hdr *tar.Header) error {
|
|||
dirNames := strings.Split(wd, "/")
|
||||
parent := root
|
||||
for _, name := range dirNames[:] {
|
||||
encoded, err := Vis(name)
|
||||
encoded, err := Vis(name, DefaultVisFlags)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue