Use '/' path separator on Windows for tar archives
Creating a tar archive on Windows with a directory results instead in the file having '\' in its name, and on extraction on POSIX, does not create the appropriate directory.
To fix this, use path.posix to force the '/' path separator even if creating the archive on Windows.
Fixes #22 .
Hmmm. How do I squash commits in the browser?
Will this be merged? Currently tgz created on windows are not readable on linux.
@Infiltrator Can you add a test case for this bug fix?
I know this issue is old, but I confirmed that this fixes issues on Windows 10. I am generating a tgz using:
compressing.tgz.compressDir(stagingDir, outputDest);
Tools like 7Zip are unable to correctly extract the folder structure. When I apply the changes in this PR, everything works as expected.
Codecov Report
Merging #24 (72651bb) into master (290b7b3) will not change coverage. Report is 1 commits behind head on master. The diff coverage is
100.00%.
@@ Coverage Diff @@
## master #24 +/- ##
=======================================
Coverage 96.64% 96.64%
=======================================
Files 19 19
Lines 597 597
Branches 112 112
=======================================
Hits 577 577
Misses 20 20
| Files Changed | Coverage Δ | |
|---|---|---|
| lib/tar/stream.js | 96.51% <100.00%> (ø) |
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more
:tada: This PR is included in version 1.9.1 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Thanks @fengmk2 for pushing this along. I'm trying to create a test for this, but there are a couple issues which fall into the "not worth it" category for me:
- The tests will need to run on Windows to make sure it truly passes.
- The bug doesn't happen using this library alone - meaning, this tool can uncompress files that it created. In order to actually test this, we will need to run
tarcommands (if it exists) or 3rd party tools to uncompress the files.
None of this seems worth it for what appears to be a reasonable and simple fix. Thanks for getting this in!