From 528f0971b5710d8a53bb936c495ae376924d9b64 Mon Sep 17 00:00:00 2001 From: X1nto Date: Mon, 13 Dec 2021 13:58:56 +0400 Subject: [PATCH] update ManagerSuFile --- .../java/com/vanced/manager/core/io/ManagerSuFile.kt | 11 +++++++++-- .../java/com/vanced/manager/core/io/SUIOException.kt | 4 ++++ 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 app/src/main/java/com/vanced/manager/core/io/SUIOException.kt diff --git a/app/src/main/java/com/vanced/manager/core/io/ManagerSuFile.kt b/app/src/main/java/com/vanced/manager/core/io/ManagerSuFile.kt index 7c97db25..9b2d1b48 100644 --- a/app/src/main/java/com/vanced/manager/core/io/ManagerSuFile.kt +++ b/app/src/main/java/com/vanced/manager/core/io/ManagerSuFile.kt @@ -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(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 + } } \ No newline at end of file diff --git a/app/src/main/java/com/vanced/manager/core/io/SUIOException.kt b/app/src/main/java/com/vanced/manager/core/io/SUIOException.kt new file mode 100644 index 00000000..e9af15da --- /dev/null +++ b/app/src/main/java/com/vanced/manager/core/io/SUIOException.kt @@ -0,0 +1,4 @@ +package com.vanced.manager.core.io + +class SUIOException { +} \ No newline at end of file