Fix bug with wrong paths in windows
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Fabian Stamm 2020-08-16 11:39:11 +02:00
parent 7da72872ba
commit a436a4ecb0
2 changed files with 8 additions and 9 deletions

View File

@ -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"
]
}

View File

@ -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",