New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use the system filename separator more consistently. #7331
base: main
Are you sure you want to change the base?
Conversation
I normally use macOS, but tried using Windows today and `quarto render` failed. There are several problems but this was the first one: ``` ERROR: TypeError: Cannot convert undefined or null to object Stack trace: at Function.keys (<anonymous>) at findIndexFile (file:///C:/Users/ka37/Documents/quarto-cli/src/project/types/website/website-sidebar-auto.ts:311:17) at nodesToEntries (file:///C:/Users/ka37/Documents/quarto-cli/src/project/types/website/website-sidebar-auto.ts:254:21) at sidebarItemsFromAuto (file:///C:/Users/ka37/Documents/quarto-cli/src/project/types/website/website-sidebar-auto.ts:139:16) at expandAutoSidebarItems (file:///C:/Users/ka37/Documents/quarto-cli/src/project/types/website/website-sidebar-auto.ts:37:31) at expandAutoSidebarItems (file:///C:/Users/ka37/Documents/quarto-cli/src/project/types/website/website-sidebar-auto.ts:65:31) at async resolveSidebarItems (file:///C:/Users/ka37/Documents/quarto-cli/src/project/types/website/website-navigation.ts:948:24) at async sidebarEjsData (file:///C:/Users/ka37/Documents/quarto-cli/src/project/types/website/website-navigation.ts:930:3) at async sidebarsEjsData (file:///C:/Users/ka37/Documents/quarto-cli/src/project/types/website/website-navigation.ts:900:22) ``` Notice that even though this is Windows, the stack trace reports paths in posix-style format. There's a lot of hard-coded forward-slashes in various parts of the quarto code, so I'd suggest that rather than trying to get everything right, just instead follow Deno's lead here and use URL semantics for everything.
Thanks for the PR! That's definitely a bug. I think we might need a better fix, unfortunately. Your suggestion makes it so that we accurately use OS-local separators. However, I suspect that part of the reason we had I believe your change makes it so that quarto would use |
I totally agree on normalizing to |
My previous comment was left too quickly. I should add: that's the first thing I thought of, but I was scared off by how many times Perhaps it would be better to think of paths as relative URLs and use that stdlib code instead, though I'd be a bit concerned this might break for projects on Windows network shares (UNC paths are kinda like URLs but not exactly). |
... and now you understand why this isn't a simple fix! |
I normally use macOS, but tried using Windows today and
quarto render
failed. There are several problems but this was the first one:Notice that even though this is Windows, the stack trace reports paths in posix-style format. There's a lot of hard-coded forward-slashes in various parts of the quarto code, so I'd suggest that rather than trying to get everything right, just instead follow Deno's lead here and use URL semantics for everything.
My full setup is big, but something like this in
_quarto.yml
should suffice to reproduce:(ideally I'd leave it that way, but on Windows I had to change that to
notes\\*
; that might be a separate bug report)