From 082b3ba14a3eddf18af840c8cde8254433a28a95 Mon Sep 17 00:00:00 2001 From: Maciej Gajek Date: Wed, 22 Nov 2023 12:49:20 +0100 Subject: [PATCH] Workaround for home.dir property not being set --- modules/cli/src/main/scala/scala/cli/ScalaCli.scala | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/cli/src/main/scala/scala/cli/ScalaCli.scala b/modules/cli/src/main/scala/scala/cli/ScalaCli.scala index b3b4f63fbe..7b067da175 100644 --- a/modules/cli/src/main/scala/scala/cli/ScalaCli.scala +++ b/modules/cli/src/main/scala/scala/cli/ScalaCli.scala @@ -20,6 +20,11 @@ import scala.util.Properties object ScalaCli { + if (scala.util.Try(os.Path(System.getProperty("user.home"))).isFailure) { + System.err.println("Warning: user.home property is not set, setting it to user.dir") + System.setProperty("user.home", System.getProperty("user.dir")) + } + if (Properties.isWin && isGraalvmNativeImage) // have to be initialized before running (new Argv0).get because Argv0SubstWindows uses csjniutils library // The DLL loaded by LoadWindowsLibrary is statically linke/d in