yes
mellbacon committed
Aug 17, 2022 at 11:14 UTC
0d4574e41d2ff277ec5a77bdf38be52552e7ef40
1 file changed
+11
-1
src/components/FileTree/TreeData.ts
+11
-1
@@ -1,4 +1,5 @@
1
import { dialog, fs } from "@tauri-apps/api";
2
+import { sep } from "@tauri-apps/api/path";
3
import { filetree } from "../FileTree/TreeStore";
4
let parentname: string;
5
let dir;
@@ -9,10 +10,19 @@ export async function data() {
10
return await loadTree();
11
}
12
13
+class File {
14
+ filename: string;
15
+ path: string;
16
+ constructor(filename: string, path: string) {
17
+ this.filename = filename;
18
+ this.path = path;
19
+ }
20
+}
21
export async function loadFile() {
22
let file = await dialog.open() as string;
23
if (file === null) return;
15
- return file;
24
+ let filename = file.split(sep).pop();
25
+ return new File(filename, file);
26
}
27
28
async function loadTree() {