From f8b33678508583e7833ae7f11d8f8b06927ecdba Mon Sep 17 00:00:00 2001 From: Maciej Gajek <61919032+MaciejG604@users.noreply.github.com> Date: Tue, 28 Nov 2023 08:26:49 +0100 Subject: [PATCH] Workaround for home.dir property not being set (#2573) * Workaround for home.dir property not being set * Add a TODO --- modules/cli/src/main/scala/scala/cli/ScalaCli.scala | 6 ++++++ 1 file changed, 6 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..27b626d494 100644 --- a/modules/cli/src/main/scala/scala/cli/ScalaCli.scala +++ b/modules/cli/src/main/scala/scala/cli/ScalaCli.scala @@ -20,6 +20,12 @@ import scala.util.Properties object ScalaCli { + // TODO: Remove this part once fix is released in os-lib (Issue #2585) + 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