mirror of
https://github.com/YTVanced/VancedManager
synced 2024-12-01 07:23:02 +00:00
update ManagerSuFile
This commit is contained in:
parent
3ba238c8a4
commit
528f0971b5
2 changed files with 13 additions and 2 deletions
|
@ -5,11 +5,12 @@ import com.topjohnwu.superuser.io.SuFile
|
|||
import com.vanced.manager.core.util.errString
|
||||
import com.vanced.manager.core.util.outString
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
|
||||
class ManagerSuFile : SuFile {
|
||||
|
||||
sealed class SuFileResult {
|
||||
data class Success<out V>(val result: V? = null) : SuFileResult()
|
||||
data class Success(val output: String) : SuFileResult()
|
||||
data class Error(val error: String) : SuFileResult()
|
||||
}
|
||||
|
||||
|
@ -27,6 +28,12 @@ class ManagerSuFile : SuFile {
|
|||
return SuFileResult.Success(cmd.outString)
|
||||
}
|
||||
|
||||
fun deleteResult() = cmd("rm -f @@ || rmdir -f @@")
|
||||
override fun delete(): Boolean {
|
||||
val result = cmd("rm -f @@ || rmdir -f @@")
|
||||
if (result is SuFileResult.Error)
|
||||
throw SUIOException(result.error)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package com.vanced.manager.core.io
|
||||
|
||||
class SUIOException {
|
||||
}
|
Loading…
Reference in a new issue