IJPL-149878 IJent WSL FS refactoring: explicitly define IjentWslNioFsToggler.unregisterAll

GitOrigin-RevId: a8f71609450d594e120de7cb1ec76d095a3e3ec5
This commit is contained in:
Vladimir Lagunov
2024-06-27 14:35:41 +02:00
committed by intellij-monorepo-bot
parent 1eacd1d1af
commit 70f6a49e54
2 changed files with 11 additions and 7 deletions

View File

@@ -29,7 +29,7 @@ internal class IjentWslNioFsToggleStrategy(
init {
coroutineScope.coroutineContext.job.invokeOnCompletion {
ownFileSystems.unregisterAll()
unregisterAll()
}
}
@@ -108,6 +108,10 @@ internal class IjentWslNioFsToggleStrategy(
}
}
}
fun unregisterAll() {
ownFileSystems.unregisterAll()
}
}
private fun FileSystemProvider.unwrapIjentWslNioFileSystemProvider(): IjentWslNioFileSystemProvider? =

View File

@@ -12,7 +12,6 @@ import com.intellij.openapi.util.SystemInfo
import com.intellij.platform.core.nio.fs.MultiRoutingFileSystemProvider
import com.intellij.platform.ijent.IjentId
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.cancel
import org.jetbrains.annotations.ApiStatus.Internal
import org.jetbrains.annotations.TestOnly
import org.jetbrains.annotations.VisibleForTesting
@@ -52,6 +51,12 @@ class IjentWslNioFsToggler(private val coroutineScope: CoroutineScope) {
strategy?.disable(distro)
}
@TestOnly
fun unregisterAll() {
strategy ?: error("Not available")
strategy.unregisterAll()
}
private val strategy = run {
val defaultProvider = FileSystems.getDefault().provider()
when {
@@ -69,9 +74,4 @@ class IjentWslNioFsToggler(private val coroutineScope: CoroutineScope) {
}
}
}
@TestOnly
fun unregisterAll() {
coroutineScope.cancel()
}
}