Skip to content

Commit 4c94c26

Browse files
Copilotkv9898
andauthored
Fix Windows path bug: use relative --output-dir for quarto render
Agent-Logs-Url: https://github.com/kv9898/pkgdown/sessions/1f4170a7-da79-4b03-bad2-8ba0d3b8ab5e Co-authored-by: kv9898 <105025148+kv9898@users.noreply.github.com>
1 parent a6abe43 commit 4c94c26

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

R/build-quarto-articles.R

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,22 @@ quarto_render <- function(pkg, path, quiet = TRUE, frame = caller_env()) {
107107
)
108108
write_yaml(quarto_format(pkg), metadata_path)
109109

110-
output_dir <- withr::local_tempdir("pkgdown-quarto-", .local_envir = frame)
110+
# Create the output dir inside the source directory so that we can pass a
111+
# relative path to quarto. This avoids a Windows-specific bug where Quarto
112+
# (Deno) appends absolute paths with drive letters to the project root
113+
# instead of treating them as absolute (e.g. path.join("E:\\src", "C:\\tmp")
114+
# yields "E:\\src\\C:\\tmp" rather than "C:\\tmp").
115+
render_dir <- if (fs::is_dir(path)) path else fs::path_dir(path)
116+
output_dir <- withr::local_tempdir(
117+
"pkgdown-quarto-",
118+
tmpdir = render_dir,
119+
.local_envir = frame
120+
)
111121

112122
quarto::quarto_render(
113123
path,
114124
metadata_file = metadata_path,
115-
quarto_args = c("--output-dir", output_dir),
125+
quarto_args = c("--output-dir", fs::path_rel(output_dir, start = render_dir)),
116126
quiet = quiet,
117127
as_job = FALSE
118128
)

0 commit comments

Comments
 (0)