mholt / archiver

Easily create & extract archives, and compress & decompress files of various formats
https://pkg.go.dev/github.com/mholt/archiver/v4
MIT License
4.34k stars 384 forks source link

Compressing tarball on Windows #62

Closed addelovein closed 5 years ago

addelovein commented 6 years ago

When compressing a entire folder with archiver.TarGz.Make("myfolder.tar.gz", []string{"./myfolder"})

If i open that arhive in Windows it will look great i can go through the directory structure... However when i extract this on linux it wil create filenames like this: "picons\picons\france\1_0_1_EB2_AAFF_7EB6_0_0_0_0.png" and empty folders named this: "picons\picons\france"

That is not paths that is the actual name of the file....

halfcrazy commented 6 years ago

https://github.com/mholt/archiver/blob/master/tar.go#L149

Maybe need another pr like https://github.com/mholt/archiver/pull/37 to handle this for tar format.

From http://www.gnu.org/software/tar/manual/html_node/Standard.html

The name field is the file name of the file, with directory names (if any) preceding the file name, separated by slashes.

halfcrazy commented 6 years ago

@addelovein I have a quick implementation at #64 , could you test on windows?

addelovein commented 6 years ago

@halfcrazy Sorry for delay but thanks for the attempt... However still result when extracting on NIX is: drwxrwxrwx 2 root root 40 May 1 17:00 picons\picons\united_states -rw-rw-rw- 1 root root 5724 May 1 16:59 picons\picons\united_states\1_0_1_2331_AAFF_7EB6_0_0_0_0.png -rw-rw-rw- 1 root root 3601 May 1 16:59 picons\picons\united_states\1_0_1_2332_AAFF_7EB6_0_0_0_0.png -rw-rw-rw- 1 root root 3174 May 1 16:59 picons\picons\united_states\1_0_1_2334_AAFF_7EB6_0_0_0_0.png -rw-rw-rw- 1 root root 6451 May 1 16:59 picons\picons\united_states\1_0_1_2338_AAFF_7EB6_0_0_0_0.png

johnarok commented 6 years ago

@addelovein can you re-test? With pr #77 merged, this should be fixed now.

johnarok commented 5 years ago

Closing since no activity.