Skip to content

Wrong figure folder built using custom format due to mutation #4260

@cderv

Description

@cderv

Here is the issue with traceback

[smoke] > quarto render docs\smoke-all\2022\09\30\custom-writer-emulation\customwriter-yaml.qmd --to customformat.lua => ./test.ts:126:72
error: AssertionError: Failed assertion:

--------------------------------------------------------------------------------
[smoke] > quarto render docs\smoke-all\2022\09\30\custom-writer-emulation\customwriter-yaml.qmd --to customformat.lua
          run-tests.psl ..\..\..\..\..\..\C:\Users\chris\Documents\DEV_R\quarto-cli\tests\smoke\smoke-all.test.ts

[verify] > unknown

La syntaxe du nom de fichier, de répertoire ou de volume est incorrecte. (os error 123), stat 'docs\smoke-all\2022\09\30\custom-writer-emulation\customwriter-yaml_files\figure-C:\Users\chris\Documents\DEV_R\quarto'
Error: La syntaxe du nom de fichier, de répertoire ou de volume est incorrecte. (os error 123), stat 'docs\smoke-all\2022\09\30\custom-writer-emulation\customwriter-yaml_files\figure-C:\Users\chris\Documents\DEV_R\quarto'
    at Object.lstatSync (deno:runtime/js/30_fs.js:305:9)
    at existsSync (file:///C:/Users/chris/Documents/DEV_R/quarto-cli/src/vendor/deno.land/std@0.166.0/fs/exists.ts:75:10)
    at removeIfEmptyDir (file:///C:/Users/chris/Documents/DEV_R/quarto-cli/src/core/path.ts:47:7)
    at renderCleanup (file:///C:/Users/chris/Documents/DEV_R/quarto-cli/src/command/render/cleanup.ts:101:3)
    at file:///C:/Users/chris/Documents/DEV_R/quarto-cli/src/command/render/render.ts:293:9
    at withTiming (file:///C:/Users/chris/Documents/DEV_R/quarto-cli/src/core/timing.ts:37:20)
    at Object.complete (file:///C:/Users/chris/Documents/DEV_R/quarto-cli/src/command/render/render.ts:292:7)
    at async Object.onPostProcess (file:///C:/Users/chris/Documents/DEV_R/quarto-cli/src/command/render/render-files.ts:568:28)
    at async renderFiles (file:///C:/Users/chris/Documents/DEV_R/quarto-cli/src/command/render/render-files.ts:524:7)
    at async render (file:///C:/Users/chris/Documents/DEV_R/quarto-cli/src/command/render/render-shared.ts:101:18)

We are building wrong path above docs\smoke-all\2022\09\30\custom-writer-emulation\customwriter-yaml_files\figure-C:\Users\chris\Documents\DEV_R\quarto by appending to path not correctly.

The issue is from

// compute figure format
const figureFormat = isLatexOutput(format.pandoc)
? extname(output).slice(1)
: format.pandoc.to;

as format.pandoc.to is a path. I have this in debug mode console

> figureFormat
'C:\Users\chris\Documents\DEV_R\quarto-cli\src\resources\filters\customwriter\customwriter.lua'

This leads to wrong figure directory created

const filesDir = join(dirname(input), inputFilesDir(input));
const figsDir = join(filesDir, figuresDir(figureFormat));

Maybe the issue is elsewhere though but here the empty directory are deleted even on Linux (no error on Linux , only windows)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions