mirror of
https://github.com/mvschwarz/openrig.git
synced 2026-11-07 05:56:21 -10:00
fix(daemon): create parent directory when packing bundle to missing path (#258)
This commit is contained in:
2 files changed
+16
No files matched your search
@@ -25,6 +25,11 @@ export async function pack(stagingDir: string, outputPath: string): Promise<stri
|
||||
throw new Error("Output path must end with .rigbundle");
|
||||
}
|
||||
|
||||
const outDir = nodePath.dirname(outputPath);
|
||||
if (outDir && !fs.existsSync(outDir)) {
|
||||
fs.mkdirSync(outDir, { recursive: true });
|
||||
}
|
||||
|
||||
// Collect all files in deterministic order (alphabetical)
|
||||
const allFiles = walkFilesSync(stagingDir).sort();
|
||||
|
||||
|
||||
@@ -64,6 +64,17 @@ describe("Bundle archive", () => {
|
||||
return staging;
|
||||
}
|
||||
|
||||
it("pack creates parent directory if it does not exist", async () => {
|
||||
const staging = createStaging();
|
||||
const nestedOut = path.join(tmpDir, "missing", "sub", "test.rigbundle");
|
||||
|
||||
const hash = await pack(staging, nestedOut);
|
||||
|
||||
expect(fs.existsSync(nestedOut)).toBe(true);
|
||||
expect(fs.existsSync(`${nestedOut}.sha256`)).toBe(true);
|
||||
expect(hash).toMatch(/^[a-f0-9]{64}$/);
|
||||
});
|
||||
|
||||
// T1: Pack creates valid tar.gz
|
||||
it("pack creates valid tar.gz file", async () => {
|
||||
const staging = createStaging();
|
||||
|
||||
Reference in new issue
Block a user