From 3b00a378954801499d143295e71d1cc48cb131a4 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 24 Jan 2018 22:03:30 +0100 Subject: [PATCH] use "stat -t" for getting root file sizes, "stat -c" isnt available in busybox --- .../filemanager/helpers/RootHelpers.kt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/helpers/RootHelpers.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/helpers/RootHelpers.kt index 9327b196..69368581 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/helpers/RootHelpers.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/helpers/RootHelpers.kt @@ -90,7 +90,7 @@ class RootHelpers { cmd += if (it.isDirectory) { "echo 0;" } else { - "stat -c %s ${it.path};" + "stat -t ${it.path};" } } @@ -103,9 +103,13 @@ class RootHelpers { override fun commandCompleted(id: Int, exitcode: Int) { files.forEachIndexed { index, fileDirItem -> - val size = lines[index] - if (size.areDigitsOnly()) { - fileDirItem.size = size.toLong() + var line = lines[index] + if (line != "0") { + line = line.substring(fileDirItem.path.length).trim() + val size = line.split(" ")[0] + if (size.areDigitsOnly()) { + fileDirItem.size = size.toLong() + } } } callback(path, files)