mirror of
https://kkgithub.com/actions/cache.git
synced 2025-10-26 07:54:57 +08:00
Use path.sep in path replace
This commit is contained in:
10
src/tar.ts
10
src/tar.ts
@ -28,7 +28,7 @@ async function getTarPath(args: string[]): Promise<string> {
|
||||
const systemTar = `${process.env["windir"]}\\System32\\tar.exe`;
|
||||
if (existsSync(systemTar)) {
|
||||
return systemTar;
|
||||
} else if (isGnuTar()) {
|
||||
} else if (await isGnuTar()) {
|
||||
args.push("--force-local");
|
||||
}
|
||||
}
|
||||
@ -52,9 +52,9 @@ export async function extractTar(
|
||||
const args = [
|
||||
"-xz",
|
||||
"-f",
|
||||
archivePath?.replace(/\\/g, "/"),
|
||||
archivePath.replace(new RegExp("\\" + path.sep, "g"), "/"),
|
||||
"-C",
|
||||
targetDirectory?.replace(/\\/g, "/")
|
||||
targetDirectory.replace(new RegExp("\\" + path.sep, "g"), "/")
|
||||
];
|
||||
await execTar(args);
|
||||
}
|
||||
@ -66,9 +66,9 @@ export async function createTar(
|
||||
const args = [
|
||||
"-cz",
|
||||
"-f",
|
||||
archivePath?.replace(/\\/g, "/"),
|
||||
archivePath.replace(new RegExp("\\" + path.sep, "g"), "/"),
|
||||
"-C",
|
||||
sourceDirectory?.replace(/\\/g, "/"),
|
||||
sourceDirectory.replace(new RegExp("\\" + path.sep, "g"), "/"),
|
||||
"."
|
||||
];
|
||||
await execTar(args);
|
||||
|
||||
Reference in New Issue
Block a user