[ijent] Forbid double wraps of IjentWslNioPath

GitOrigin-RevId: 2eff208a07b270deec6069f7b9836598f3469bd2
This commit is contained in:
Konstantin.Nisht
2024-12-23 17:52:40 +00:00
committed by intellij-monorepo-bot
parent 3d769fd496
commit dcb67162c1
2 changed files with 5 additions and 1 deletions
@@ -190,7 +190,7 @@ class IjentWslNioFileSystemProvider(
)
else null
return IjentWslNioPath(getFileSystem(wslId), originalPath, dosAttributes)
return IjentWslNioPath(getFileSystem(wslId), originalPath.toOriginalPath(), dosAttributes)
}
override fun remove() {
@@ -10,6 +10,10 @@ class IjentWslNioPath(
val delegate: Path,
cachedAttributes: IjentNioPosixFileAttributesWithDosAdapter?,
) : Path, BasicFileAttributesHolder2.Impl(cachedAttributes) {
init {
require(delegate !is IjentWslNioPath) { "IjentWslNioPath should be a wrapper over other instances of path, namely WindowsPath or IjentNioPath" }
}
override fun getFileSystem(): IjentWslNioFileSystem = fileSystem
override fun isAbsolute(): Boolean = delegate.isAbsolute