From 7867dc603ea3fef78cf16e6bbe3167f819fe151f Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Thu, 25 Sep 2025 12:08:10 +0200 Subject: [PATCH] [test framework] adding all Windows roots to in-memory filesystems (excluding UNC ones) GitOrigin-RevId: 140ffdfa34059f2d15337445d5103cdb2201939a --- .../src/com/intellij/testFramework/rules/InMemoryFsRule.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/platform/testFramework/extensions/src/com/intellij/testFramework/rules/InMemoryFsRule.kt b/platform/testFramework/extensions/src/com/intellij/testFramework/rules/InMemoryFsRule.kt index 4abb8d0d5cb6..2cedf6e07ed7 100644 --- a/platform/testFramework/extensions/src/com/intellij/testFramework/rules/InMemoryFsRule.kt +++ b/platform/testFramework/extensions/src/com/intellij/testFramework/rules/InMemoryFsRule.kt @@ -2,6 +2,7 @@ package com.intellij.testFramework.rules import com.github.marschall.memoryfilesystem.MemoryFileSystemBuilder +import com.intellij.openapi.util.io.OSAgnosticPathUtil import com.intellij.util.system.OS import org.junit.jupiter.api.extension.AfterEachCallback import org.junit.jupiter.api.extension.BeforeEachCallback @@ -69,7 +70,10 @@ private fun fsBuilder(windows: Boolean): MemoryFileSystemBuilder = if (windows) { val builder = MemoryFileSystemBuilder.newWindows().setCurrentWorkingDirectory("C:\\") if (OS.CURRENT == OS.Windows) { - FileSystems.getDefault().rootDirectories.forEach { builder.addRoot(it.toString()) } + FileSystems.getDefault().rootDirectories.asSequence() + .map { it.toString() } + .filter { OSAgnosticPathUtil.isAbsoluteDosPath(it) } + .forEach { builder.addRoot(it) } } builder }