mirror of https://github.com/sbt/sbt.git
fix: Only disable symlinks when truly not supported (#8479)
This commit is contained in:
parent
113b6eb103
commit
985cf94bb7
|
|
@ -293,10 +293,16 @@ class DiskActionCacheStore(base: Path, converter: FileConverter) extends Abstrac
|
||||||
IO.createDirectory(outPath.getParent().toFile())
|
IO.createDirectory(outPath.getParent().toFile())
|
||||||
val result = Retry:
|
val result = Retry:
|
||||||
if Files.exists(outPath) then IO.delete(outPath.toFile())
|
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)
|
try Files.createSymbolicLink(outPath, casFile)
|
||||||
catch
|
catch
|
||||||
case e: FileSystemException =>
|
case e: FileSystemException =>
|
||||||
|
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
|
if Util.isWindows then
|
||||||
scala.Console.err.println(
|
scala.Console.err.println(
|
||||||
"[info] failed to a create symbolic link. consider enabling Developer Mode"
|
"[info] failed to a create symbolic link. consider enabling Developer Mode"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue