Skip to content

Commit 3b00a37

Browse files
committed
use "stat -t" for getting root file sizes, "stat -c" isnt available in busybox
1 parent 861f9ff commit 3b00a37

File tree

1 file changed

+8
-4
lines changed
  • app/src/main/kotlin/com/simplemobiletools/filemanager/helpers

1 file changed

+8
-4
lines changed

app/src/main/kotlin/com/simplemobiletools/filemanager/helpers/RootHelpers.kt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class RootHelpers {
9090
cmd += if (it.isDirectory) {
9191
"echo 0;"
9292
} else {
93-
"stat -c %s ${it.path};"
93+
"stat -t ${it.path};"
9494
}
9595
}
9696

@@ -103,9 +103,13 @@ class RootHelpers {
103103

104104
override fun commandCompleted(id: Int, exitcode: Int) {
105105
files.forEachIndexed { index, fileDirItem ->
106-
val size = lines[index]
107-
if (size.areDigitsOnly()) {
108-
fileDirItem.size = size.toLong()
106+
var line = lines[index]
107+
if (line != "0") {
108+
line = line.substring(fileDirItem.path.length).trim()
109+
val size = line.split(" ")[0]
110+
if (size.areDigitsOnly()) {
111+
fileDirItem.size = size.toLong()
112+
}
109113
}
110114
}
111115
callback(path, files)

0 commit comments

Comments
 (0)