Fix bug with wrong paths in windows
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
7da72872ba
commit
a436a4ecb0
@ -1,13 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "@denreg-tar",
|
"name": "@denreg-tar",
|
||||||
"version": "0.2.1",
|
"version": "0.2.2",
|
||||||
"description": "Pack and Unpack tar files",
|
"description": "Pack and Unpack tar files",
|
||||||
"author": "Fabian Stamm <dev@fabianstamm.de>",
|
"author": "Fabian Stamm <dev@fabianstamm.de>",
|
||||||
"contributors": [],
|
"contributors": [],
|
||||||
"files": [
|
"files": ["**/*.ts", "**/*.js", "README.md"]
|
||||||
"**/*.ts",
|
}
|
||||||
"**/*.js",
|
|
||||||
"importmap.json",
|
|
||||||
"README.md"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
import { FS, Path, Tar } from "./deps.ts";
|
import { FS, Path, Tar } from "./deps.ts";
|
||||||
|
|
||||||
|
function toUnix(path: string): string {
|
||||||
|
return path.replace(/\\/g, "/");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Uncompresses a tar file to a certain location
|
* Uncompresses a tar file to a certain location
|
||||||
* @param {string} src Tar file to be uncompressed
|
* @param {string} src Tar file to be uncompressed
|
||||||
@ -65,7 +69,7 @@ export async function compress(
|
|||||||
}
|
}
|
||||||
const walker = FS.walk(src, { includeDirs: true, includeFiles: true });
|
const walker = FS.walk(src, { includeDirs: true, includeFiles: true });
|
||||||
for await (const file of walker) {
|
for await (const file of walker) {
|
||||||
const relativePath = Path.relative(root, file.path);
|
const relativePath = toUnix(Path.relative(root, file.path));
|
||||||
if (file.isDirectory) {
|
if (file.isDirectory) {
|
||||||
await tar.append(relativePath, {
|
await tar.append(relativePath, {
|
||||||
type: "directory",
|
type: "directory",
|
||||||
|
Loading…
Reference in New Issue
Block a user