mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Revert "[eel] Add EelProvider methods for environment-aware path handling (IJPL-178632)"
These helpers are redundant: an equality check already covers all use‑cases. Prefer direct comparisons to extra API surface, e.g.:
```
if (path.getEelDescriptor() == descriptor) { ... }
```
This reverts commit 7e752f7ea6461f7c49d3c71c6077cef7d0c4069f.
GitOrigin-RevId: 07e54295aef350501bbb74aa4275ab9e1188c241
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e7abf3e814
commit
7bb530b3ee
@@ -159,32 +159,6 @@ interface EelProvider {
|
||||
|
||||
// TODO Better name.
|
||||
fun getEelMachineByInternalName(internalName: String): EelMachine?
|
||||
|
||||
/**
|
||||
* Returns `true` if one of [EelMachine] associated with this provider is responsible for the path.
|
||||
*/
|
||||
fun handlesPath(path: @MultiRoutingFileSystemPath String): Boolean
|
||||
|
||||
/**
|
||||
* Returns a lightweight predicate that checks whether a given path is handled by the specified machine.
|
||||
*
|
||||
* Contract and performance:
|
||||
* - Must be cheap to obtain and safe to call repeatedly.
|
||||
* - Must not allocate, start, or initialize the machine or any external resources.
|
||||
* - Implementations should avoid I/O, process launches, or network calls; use only fast, local checks (e.g., prefix matching).
|
||||
*
|
||||
* Nullability:
|
||||
* - Returns `null` if the machine is not associated with this provider.
|
||||
*
|
||||
* Semantics:
|
||||
* - The predicate should return true for any path that belongs to, or could belong to, the machine managed by this provider.
|
||||
* - Consistency expectation: within the same provider, for a given `path`, if the predicate returned by [getPathHandlerPredicate]
|
||||
* returns `true` for that `path`, then [handlesPath] should also return `true` for the same `path`.
|
||||
*
|
||||
* @param machine the target environment/machine
|
||||
* @return a predicate to test paths for this machine, or `null` if not applicable
|
||||
*/
|
||||
fun getPathHandlerPredicate(machine: EelMachine): ((path: @MultiRoutingFileSystemPath String) -> Boolean)?
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
|
||||
@@ -195,23 +195,6 @@ class WslEelProvider : EelProvider {
|
||||
else
|
||||
null
|
||||
|
||||
override fun handlesPath(path: @MultiRoutingFileSystemPath String): Boolean {
|
||||
if (!WslIjentAvailabilityService.getInstance().useIjentForWslNioFileSystem()) {
|
||||
return false
|
||||
}
|
||||
|
||||
return WslPath.parseWindowsUncPath(path) != null
|
||||
}
|
||||
|
||||
override fun getPathHandlerPredicate(machine: EelMachine): ((path: @MultiRoutingFileSystemPath String) -> Boolean)? {
|
||||
if (machine !is WslEelMachine) return null
|
||||
if (!WslIjentAvailabilityService.getInstance().useIjentForWslNioFileSystem()) return null
|
||||
return predicate@{ path ->
|
||||
val windowsUncPath = WslPath.parseWindowsUncPath(path) ?: return@predicate false
|
||||
windowsUncPath.distributionId == machine.distribution.id
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun tryInitialize(@MultiRoutingFileSystemPath path: String) {
|
||||
if (!WslIjentAvailabilityService.getInstance().useIjentForWslNioFileSystem()) {
|
||||
return
|
||||
|
||||
@@ -100,13 +100,6 @@ fun CoroutineScope.registerIjentNioFs(
|
||||
override fun getEelMachineByInternalName(internalName: String): EelMachine? =
|
||||
if (internalName == ijent.descriptor.machine.name) ijent.descriptor.machine
|
||||
else null
|
||||
|
||||
override fun handlesPath(path: String): Boolean = path.startsWith(root)
|
||||
|
||||
override fun getPathHandlerPredicate(machine: EelMachine): ((path: @MultiRoutingFileSystemPath String) -> Boolean)? {
|
||||
if (machine != ijent.descriptor.machine) return null
|
||||
return { path -> path.startsWith(root) }
|
||||
}
|
||||
},
|
||||
disposable,
|
||||
)
|
||||
|
||||
@@ -59,10 +59,8 @@ internal fun eelInitializer(os: EelPlatform): TestFixtureInitializer<IsolatedFil
|
||||
val meaningfulDirName = "eel-fixture-${os.name}"
|
||||
val directory = Files.createTempDirectory(meaningfulDirName)
|
||||
|
||||
val fakeRootOsAgnostic = "/eel-test-${directory.name}"
|
||||
|
||||
val fakeRoot = if (SystemInfo.isUnix) {
|
||||
fakeRootOsAgnostic
|
||||
"/eel-test-${directory.name}"
|
||||
}
|
||||
else {
|
||||
"\\\\eel-test\\${directory.name}"
|
||||
@@ -114,13 +112,6 @@ internal fun eelInitializer(os: EelPlatform): TestFixtureInitializer<IsolatedFil
|
||||
override fun getEelMachineByInternalName(internalName: String): EelMachine? =
|
||||
if (internalName == meaningfulDirName) descriptor.machine
|
||||
else null
|
||||
|
||||
override fun handlesPath(path: String): Boolean = path.startsWith(fakeRootOsAgnostic)
|
||||
|
||||
override fun getPathHandlerPredicate(machine: EelMachine): ((path: @MultiRoutingFileSystemPath String) -> Boolean)? {
|
||||
if (machine != descriptor.machine) return null
|
||||
return { path -> path.startsWith(fakeRootOsAgnostic) }
|
||||
}
|
||||
},
|
||||
disposable,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user