Skip to content

Commit ec9c184

Browse files
committed
feat: file explorer
1 parent c2ea3ab commit ec9c184

File tree

16 files changed

+208
-52
lines changed

16 files changed

+208
-52
lines changed

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!DOCTYPE html>
2-
<html lang="en">
2+
<html lang="en" spellcheck="false">
33
<head>
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"globals": "^15.11.0",
5252
"licia": "^1.46.0",
5353
"luna-data-grid": "^1.3.0",
54-
"luna-file-list": "^0.2.0",
54+
"luna-file-list": "^0.3.0",
5555
"luna-icon-list": "^0.2.2",
5656
"luna-image-viewer": "^0.5.2",
5757
"luna-logcat": "^0.5.1",
@@ -61,7 +61,7 @@
6161
"luna-performance-monitor": "^1.2.1",
6262
"luna-setting": "^2.0.1",
6363
"luna-tab": "^0.3.2",
64-
"luna-toolbar": "^0.9.0",
64+
"luna-toolbar": "^0.9.1",
6565
"mobx": "^6.13.5",
6666
"mobx-react-lite": "^4.0.7",
6767
"protobufjs": "^7.4.0",

src/common/langs/en-US.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,5 +119,13 @@
119119
"terminal": "Terminal",
120120
"tools": "Tools",
121121
"ok": "OK",
122-
"cancel": "Cancel"
122+
"cancel": "Cancel",
123+
"back": "Back",
124+
"forward": "Forward",
125+
"up": "Up",
126+
"iconView": "Icon View",
127+
"listView": "List View",
128+
"size": "Size",
129+
"dateModified": "Date Modified",
130+
"directory": "Directory"
123131
}

src/common/langs/zh-CN.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,5 +119,13 @@
119119
"terminal": "终端",
120120
"tools": "工具",
121121
"ok": "确定",
122-
"cancel": "取消"
122+
"cancel": "取消",
123+
"back": "返回",
124+
"forward": "前进",
125+
"up": "上一级",
126+
"iconView": "图标视图",
127+
"listView": "列表视图",
128+
"size": "大小",
129+
"dateModified": "修改日期",
130+
"directory": "文件夹"
123131
}

src/main/lib/adb/file.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Client } from '@devicefarmer/adbkit'
22
import fs from 'node:fs'
33
import { handleEvent } from '../util'
4-
import map from 'licia/map'
54

65
let client: Client
76

@@ -25,12 +24,23 @@ async function readDir(deviceId: string, path: string) {
2524
const device = await client.getDevice(deviceId)
2625
const files: any[] = await device.readdir(path)
2726

28-
return map(files, (file) => {
29-
return {
27+
const ret: any[] = []
28+
for (let i = 0, len = files.length; i < len; i++) {
29+
const file = files[i]
30+
const item: any = {
3031
name: file.name,
31-
directory: file.isDirectory(),
32+
directory: !file.isFile(),
33+
mtime: new Date(file.mtimeMs),
3234
}
33-
})
35+
36+
if (!item.directory) {
37+
item.size = file.size
38+
}
39+
40+
ret.push(item)
41+
}
42+
43+
return ret
3444
}
3545

3646
export async function init(c: Client) {

src/renderer/icon.css

Lines changed: 28 additions & 22 deletions
Large diffs are not rendered by default.

src/renderer/icon/arrow-left.svg

Lines changed: 4 additions & 4 deletions
Loading

src/renderer/icon/arrow-right.svg

Lines changed: 4 additions & 4 deletions
Loading

src/renderer/icon/arrow-up.svg

Lines changed: 4 additions & 4 deletions
Loading

src/renderer/icon/grid.svg

Lines changed: 6 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)