fix: list dir 添加 文件 size type 等属性
This commit is contained in:
@@ -306,7 +306,7 @@ public class AdbUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String statFilePath = isDir ? Paths.get(path).resolve(name).toString() : path;
|
String statFilePath = isDir ? Paths.get(path).resolve(name).toString() : path;
|
||||||
String statCommand = "shell stat -c \"'%N %a %X %Y'\" " + statFilePath;
|
String statCommand = "shell stat -c \"'%N %A %g %u %s %a %X %Y'\" " + statFilePath;
|
||||||
futureList.add(
|
futureList.add(
|
||||||
CompletableFuture.supplyAsync(() -> {
|
CompletableFuture.supplyAsync(() -> {
|
||||||
String statResult = CommandExec.exec(AdbCommandBuilder.builder()
|
String statResult = CommandExec.exec(AdbCommandBuilder.builder()
|
||||||
@@ -318,15 +318,24 @@ public class AdbUtil {
|
|||||||
List<String> list = Arrays.asList(statResult.split("\\s+"));
|
List<String> list = Arrays.asList(statResult.split("\\s+"));
|
||||||
Collections.reverse(list);
|
Collections.reverse(list);
|
||||||
|
|
||||||
String fullName = list.get(3).replaceAll("'|`", "");
|
String fullName = list.get(7).replaceAll("'|`", "");
|
||||||
Map<String, Object> relMap = T.MapUtil.newHashMap();
|
Map<String, Object> relMap = T.MapUtil.newHashMap();
|
||||||
relMap.put("name", name);
|
relMap.put("name", name);
|
||||||
relMap.put("value", T.MapUtil.builder()
|
relMap.put("value", T.MapUtil.builder()
|
||||||
.put("id", Base32Codec.Base32Encoder.ENCODER.encode(fullName.getBytes()))
|
.put("id", Base32Codec.Base32Encoder.ENCODER.encode(fullName.getBytes()))
|
||||||
.put("fullName", fullName)
|
.put("fullName", fullName)
|
||||||
|
.put("gid", Long.parseLong(list.get(5)))
|
||||||
|
.put("uid", Long.parseLong(list.get(4)))
|
||||||
|
.put("size", Long.parseLong(list.get(3)))
|
||||||
.put("permissions", Long.parseLong(list.get(2)))
|
.put("permissions", Long.parseLong(list.get(2)))
|
||||||
.put("cts", Long.parseLong(list.get(1)))
|
.put("cts", Long.parseLong(list.get(1)))
|
||||||
.put("uts", Long.parseLong(list.get(0)))
|
.put("uts", Long.parseLong(list.get(0)))
|
||||||
|
.put("isDir", list.get(6).startsWith("d"))
|
||||||
|
.put("isBlk", list.get(6).startsWith("b"))
|
||||||
|
.put("isFifo", list.get(6).startsWith("p"))
|
||||||
|
.put("isLink", list.get(6).startsWith("l"))
|
||||||
|
.put("isReg", list.get(6).startsWith("-"))
|
||||||
|
.put("isSock", list.get(6).startsWith("s"))
|
||||||
.build());
|
.build());
|
||||||
return relMap;
|
return relMap;
|
||||||
}, getThreadPool())
|
}, getThreadPool())
|
||||||
|
|||||||
Reference in New Issue
Block a user