Skip to content

Commit ab743f9

Browse files
committed
bugfix: Don't use cache directory with null in it's path
This is a bug in ProjectDirectories, which seems to be super hard to fix, so instead we can special case it. This is not super important to use that directory anyway, we fall back to local workspace. Fixes scalameta#5590
1 parent e896373 commit ab743f9

File tree

1 file changed

+7
-2
lines changed
  • metals/src/main/scala/scala/meta/internal/metals

1 file changed

+7
-2
lines changed

metals/src/main/scala/scala/meta/internal/metals/Trace.scala

+7-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,13 @@ object Trace {
2626
// the path making it difficult to tail/cat from the terminal and cmd+click from VS Code.
2727
// Instead, we use the `cacheDir` which has no spaces. The logs are safe to remove so
2828
// putting them in the "cache directory" makes more sense compared to the "config directory".
29-
AbsolutePath(projectDirectories.cacheDir)
30-
}.toOption
29+
val cacheDir = projectDirectories.cacheDir
30+
// https://github.com/scalameta/metals/issues/5590
31+
// deal with issue on windows and PowerShell, which would cause us to create a null directory in the workspace
32+
if (cacheDir.startsWith("null\\"))
33+
None
34+
else Some(AbsolutePath(cacheDir))
35+
}.toOption.flatten
3136

3237
private val localDirectory: AbsolutePath =
3338
PathIO.workingDirectory.resolve(".metals/")

0 commit comments

Comments
 (0)