File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
app/src/main/java/org/andbootmgr/app Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -273,7 +273,7 @@ private fun StartSdLess(c: CreatePartDataHolder) {
273273 if (c.freeSpace == null ) {
274274 LaunchedEffect (Unit ) {
275275 withContext(Dispatchers .IO ) {
276- c.freeSpace = SDLessUtils .getFreeSpaceBytes()
276+ c.freeSpace = SDLessUtils .getFreeSpaceBytes(c.vm.logic )
277277 }
278278 }
279279 LoadingCircle (stringResource(R .string.loading), modifier = Modifier .fillMaxSize())
Original file line number Diff line number Diff line change @@ -4,10 +4,12 @@ import com.topjohnwu.superuser.Shell
44import com.topjohnwu.superuser.io.SuFile
55import org.andbootmgr.app.DeviceLogic
66import java.io.File
7+ import kotlin.math.max
78
89object SDLessUtils {
9- fun getFreeSpaceBytes (): Long {
10- return 4L * 1024L * 1024L * 1024L // TODO
10+ fun getFreeSpaceBytes (logic : DeviceLogic ): Long {
11+ val raw = Shell .cmd(" stat -f ${logic.abmSdLessBootset} -c '%f:%S'" ).exec().out .joinToString(" \n " ).split(" :" ).map { it.trim().toLong() }
12+ return max(raw[0 ] * raw[1 ] - 1024L * 1024L * 1024L , 0 )
1113 }
1214
1315 fun getSpaceUsageBytes (logic : DeviceLogic , fn : String ): Long? {
You can’t perform that action at this time.
0 commit comments