node-modules / compressing

Everything you need for compressing and uncompressing
MIT License
431 stars 36 forks source link

fix: Use '/' path separator on Windows for tar archives #24

Closed Infiltrator closed 1 year ago

Infiltrator commented 5 years ago

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.

closes https://github.com/node-modules/compressing/issues/22

Infiltrator commented 5 years ago

Fixes #22 .

Infiltrator commented 5 years ago

Hmmm. How do I squash commits in the browser?

zevero commented 3 years ago

Will this be merged? Currently tgz created on windows are not readable on linux.

fengmk2 commented 2 years ago

@Infiltrator Can you add a test case for this bug fix?

DesignByOnyx commented 1 year ago

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[bot] commented 1 year ago

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

github-actions[bot] commented 1 year ago

:tada: This PR is included in version 1.9.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

DesignByOnyx commented 1 year ago

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:

None of this seems worth it for what appears to be a reasonable and simple fix. Thanks for getting this in!