fix: Only disable symlinks when truly not supported (#8479)

This commit is contained in:
MkDev11 2026-01-11 10:04:37 -08:00 committed by GitHub
parent 113b6eb103
commit 985cf94bb7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 6 deletions

View File

@ -293,15 +293,21 @@ class DiskActionCacheStore(base: Path, converter: FileConverter) extends Abstrac
IO.createDirectory(outPath.getParent().toFile())
val result = Retry:
if Files.exists(outPath) then IO.delete(outPath.toFile())
if symlinkSupported.get() then
if symlinkSupported.get() && Files.exists(casFile) then
try Files.createSymbolicLink(outPath, casFile)
catch
case e: FileSystemException =>
if Util.isWindows then
scala.Console.err.println(
"[info] failed to a create symbolic link. consider enabling Developer Mode"
)
symlinkSupported.set(false)
val msg = Option(e.getMessage).getOrElse("")
val isSymlinkNotSupported =
msg.contains("privilege") ||
msg.contains("Operation not permitted") ||
msg.contains("A required privilege is not held")
if isSymlinkNotSupported then
if Util.isWindows then
scala.Console.err.println(
"[info] failed to a create symbolic link. consider enabling Developer Mode"
)
symlinkSupported.set(false)
copyFile(outPath)
else copyFile(outPath)
afterFileWrite(ref, result, outputDirectory)