From 6436b2be29f629d29c062190e759e6ed190f402b Mon Sep 17 00:00:00 2001 From: Carlos Scheidegger Date: Thu, 20 Mar 2025 13:04:52 -0400 Subject: [PATCH 1/2] create project temp in correct directory and clean it up. --- src/core/temp.ts | 2 +- src/project/project-context.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/temp.ts b/src/core/temp.ts index a46f67e7cc2..74bb4cf90d9 100644 --- a/src/core/temp.ts +++ b/src/core/temp.ts @@ -56,8 +56,8 @@ export function globalTempContext() { export function createTempContext(options?: Deno.MakeTempOptions): TempContext { let dir: string | undefined = Deno.makeTempDirSync({ - ...options, dir: tempDir, + ...options, }); const tempContextCleanupHandlers: VoidFunction[] = []; diff --git a/src/project/project-context.ts b/src/project/project-context.ts index f8ec9345e49..58d6558f4c2 100644 --- a/src/project/project-context.ts +++ b/src/project/project-context.ts @@ -265,7 +265,8 @@ export async function projectContext( } const temp = createTempContext({ - dir: join(dir, ".quarto", "temp"), + dir: join(dir, ".quarto"), + prefix: "quarto-session-temp", }); const result: ProjectContext = { resolveBrand: async (fileName?: string) => @@ -313,6 +314,7 @@ export async function projectContext( temp, cleanup: () => { result.diskCache.close(); + temp.cleanup(); }, }; From e34420fe8adaa84389cb848a580378d0dd0a6897 Mon Sep 17 00:00:00 2001 From: Carlos Scheidegger Date: Thu, 20 Mar 2025 13:44:55 -0400 Subject: [PATCH 2/2] ensure dir exists when non-default --- src/core/temp.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/core/temp.ts b/src/core/temp.ts index 74bb4cf90d9..503fe3faf18 100644 --- a/src/core/temp.ts +++ b/src/core/temp.ts @@ -55,6 +55,9 @@ export function globalTempContext() { } export function createTempContext(options?: Deno.MakeTempOptions): TempContext { + if (options?.dir) { + ensureDirSync(options?.dir); + } let dir: string | undefined = Deno.makeTempDirSync({ dir: tempDir, ...options,