Skip to content

Removing empty dir is not working as wrong path is created (when outputing to stdout) #4194

@cderv

Description

@cderv

Test error

[smoke] > quarto render docs\project\site -o - => ./test.ts:121:72
error: AssertionError: Failed assertion:

--------------------------------------------------------------------------------
[smoke] > quarto render docs\project\site -o -
          run-tests.psl ..\..\..\..\..\..\C:\Users\chris\Documents\DEV_R\quarto-cli\tests\smoke\project\project-stdout.test.ts

[verify] > unknown

La syntaxe du nom de fichier, de répertoire ou de volume est incorrecte. (os error 123), stat 'C:\Users\chris\Documents\DEV_R\quarto-cli\tests\docs\project\site\C:\Users\chris\AppData\Local\Temp\quarto-session96c8468e\9b1cbc71\dc6b9af2_files'
Error: La syntaxe du nom de fichier, de répertoire ou de volume est incorrecte. (os error 123), stat 'C:\Users\chris\Documents\DEV_R\quarto-cli\tests\docs\project\site\C:\Users\chris\AppData\Local\Temp\quarto-session96c8468e\9b1cbc71\dc6b9af2_files'
    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 renderProject (file:///C:/Users/chris/Documents/DEV_R/quarto-cli/src/command/render/project.ts:347:9)
    at async Command.fn (file:///C:/Users/chris/Documents/DEV_R/quarto-cli/src/command/render/cmd.ts:193:26)
    at async Command.execute (file:///C:/Users/chris/Documents/DEV_R/quarto-cli/src/vendor/deno.land/x/cliffy@v0.25.4/command/command.ts:1790:7)
    at async quarto (file:///C:/Users/chris/Documents/DEV_R/quarto-cli/src/quarto.ts:111:3)
    at async Object.execute (file:///C:/Users/chris/Documents/DEV_R/quarto-cli/tests/test.ts:68:5)
    at async fn (file:///C:/Users/chris/Documents/DEV_R/quarto-cli/tests/test.ts:165:11)
    at async Object.testStepSanitizer [as fn] (deno:cli/js/40_testing.js:448:7)

That is definitely not correctly build

C:\Users\chris\Documents\DEV_R\quarto-cli\tests\docs\project\site\C:\Users\chris\AppData\Local\Temp\quarto-session96c8468e\9b1cbc71\dc6b9af2_files

It comes from

if (!keepFiles) {
const filesDir = join(
projDir,
dirname(renderedFile.file),
inputFilesDir(renderedFile.file),
);
removeIfEmptyDir(filesDir);
}

If I had some log info

      if (!keepFiles) {
        console.log(projDir);
        console.log(renderedFile.file);
        console.log(dirname(renderedFile.file));
        console.log(inputFilesDir(renderedFile.file));

this is the result

C:\Users\chris\Documents\DEV_R\quarto-cli\tests\docs\project\site
C:\Users\chris\AppData\Local\Temp\quarto-session96c8468e\9b1cbc71\dc6b9af2.html
C:\Users\chris\AppData\Local\Temp\quarto-session96c8468e\9b1cbc71
dc6b9af2_files

Definitely not right

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