Skip to content

Commit 70e69d6

Browse files
committed
clean up fictional .quarto directory created by --output-dir in non-project settings
1 parent 3922035 commit 70e69d6

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/command/render/project.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import {
2828
kProjectType,
2929
ProjectContext,
3030
} from "../../project/types.ts";
31+
import { kQuartoScratch } from "../../project/project-scratch.ts";
3132

3233
import { projectType } from "../../project/types/project-types.ts";
3334
import { copyResourceFile } from "../../project/project-resources.ts";
@@ -804,6 +805,20 @@ export async function renderProject(
804805
projectRenderConfig.behavior.incremental,
805806
);
806807
}
808+
809+
// in addition to the cleanup above, if forceClean is set, we need to clean up the project scratch dir
810+
// entirely. See options.forceClean in render-shared.ts
811+
// .quarto is really a fiction created because of `--output-dir` being set on non-project
812+
// renders
813+
//
814+
// cf https://github.com/quarto-dev/quarto-cli/issues/9745#issuecomment-2125951545
815+
if (projectRenderConfig.options.forceClean) {
816+
const scratchDir = join(projDir, kQuartoScratch);
817+
if (existsSync(scratchDir)) {
818+
Deno.removeSync(scratchDir, { recursive: true });
819+
}
820+
}
821+
807822
return projResults;
808823
}
809824

0 commit comments

Comments
 (0)