@@ -74,13 +74,9 @@ function walk_outputs(f, root, docs::Vector{MultiDocRef}, dirs::Vector{String})
74
74
p = joinpath (root, ref. path)
75
75
for dir in dirs
76
76
dirpath = joinpath (p, dir)
77
- # Symlinks do not really work on Windows. There are permissions problems and we can not
78
- # actually traverse them.
79
- if Sys. iswindows () && islink (dirpath)
80
- @warn " [WINDOWS] Symlink encountered at $(dirpath) -- excluding from search index, since symlinks are not properly supported on Windows."
77
+ if ! _windows_symlink_wrapper (isdir, dirpath)
81
78
continue
82
79
end
83
- isdir (dirpath) || continue
84
80
DocumenterTools. walkdocs (dirpath, DocumenterTools. isdochtml) do fileinfo
85
81
f (relpath (dirname (fileinfo. fullpath), root), fileinfo. fullpath)
86
82
end
@@ -487,4 +483,27 @@ function inject_styles_and_global_navigation(
487
483
end
488
484
end
489
485
486
+ function _windows_symlink_wrapper (f:: Base.Callable , path:: AbstractString )
487
+ if Sys. iswindows () && islink (path)
488
+ if isinteractive ()
489
+ @warn """
490
+ A symlink was ignored for $(f) at $(path)
491
+ This only happens when running interactive on Windows."""
492
+ return false
493
+ else
494
+ throw (SymlinkOnWindowsError ())
495
+ end
496
+ end
497
+ return f (path)
498
+ end
499
+
500
+ struct SymlinkOnWindowsError <: Exception end
501
+ function Base. showerror (io:: IO , err:: SymlinkOnWindowsError )
502
+ print (io, """
503
+ SymlinkOnWindowsError: this builds requires symlinks, but these are not properly supported in Windows
504
+ You can still run the build interactively for debugging/testing (i.e. in the REPL), but the
505
+ build will not exactly match the full build.""" )
506
+ print (io, err. msg)
507
+ end
508
+
490
509
end
0 commit comments