remove dependence on system isodrive bin, instead use bundled bin
This commit is contained in:
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[submodule "isodrive"]
|
||||||
|
path = isodrive
|
||||||
|
url = https://git.shihaam.dev/shihaam/isodrive
|
||||||
@@ -58,42 +58,14 @@ class IsoDriveManager(private val context: Context) {
|
|||||||
binaryPath = targetFile.absolutePath
|
binaryPath = targetFile.absolutePath
|
||||||
true
|
true
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
// Binary not bundled yet, will use system isodrive if available
|
// Binary extraction failed
|
||||||
checkSystemBinary()
|
false
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun checkSystemBinary(): Boolean = withContext(Dispatchers.IO) {
|
|
||||||
// Check common locations first (more reliable than 'which')
|
|
||||||
val commonPaths = listOf(
|
|
||||||
"/data/adb/modules/isodrive-magisk/system/bin/isodrive",
|
|
||||||
"/data/adb/modules/isodrive/system/bin/isodrive",
|
|
||||||
"/system/bin/isodrive",
|
|
||||||
"/system/xbin/isodrive",
|
|
||||||
"/data/local/tmp/isodrive",
|
|
||||||
"/vendor/bin/isodrive"
|
|
||||||
)
|
|
||||||
for (path in commonPaths) {
|
|
||||||
val checkResult = RootManager.executeCommand("test -f $path && echo exists")
|
|
||||||
if (checkResult.success && checkResult.output.contains("exists")) {
|
|
||||||
binaryPath = path
|
|
||||||
return@withContext true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try 'which' as fallback
|
|
||||||
val result = RootManager.executeCommand("which isodrive 2>/dev/null")
|
|
||||||
if (result.success && result.output.isNotBlank()) {
|
|
||||||
binaryPath = result.output.trim()
|
|
||||||
return@withContext true
|
|
||||||
}
|
|
||||||
|
|
||||||
false
|
|
||||||
}
|
|
||||||
|
|
||||||
suspend fun isSupported(): SupportStatus = withContext(Dispatchers.IO) {
|
suspend fun isSupported(): SupportStatus = withContext(Dispatchers.IO) {
|
||||||
// First check if binary is available
|
// First check if binary is available
|
||||||
if (binaryPath == null && !extractBinary()) {
|
if (binaryPath == null && !extractBinary()) {
|
||||||
|
|||||||
1
isodrive
Submodule
1
isodrive
Submodule
Submodule isodrive added at 2e9f28bd90
Reference in New Issue
Block a user