Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
157 changes: 157 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@
"cordova-plugin-websocket": {},
"cordova-plugin-buildinfo": {},
"cordova-plugin-browser": {},
"com.foxdebug.acode.rk.exec.terminal": {},
"com.foxdebug.acode.rk.exec.proot": {},
"cordova-plugin-sftp": {},
"cordova-plugin-system": {},
"com.foxdebug.acode.rk.exec.terminal": {},
"com.foxdebug.acode.rk.exec.proot": {}
"com.foxdebug.acode.rk.file": {}
},
"platforms": [
"android"
Expand Down Expand Up @@ -80,7 +81,9 @@
"cordova-plugin-system": "file:src/plugins/system",
"cordova-plugin-websocket": "file:src/plugins/websocket",
"css-loader": "^7.1.2",
"file": "file:src/plugins/file",
"mini-css-extract-plugin": "^2.9.3",
"native_file": "file:src/plugins/nativeFile",
"path-browserify": "^1.0.1",
"postcss-loader": "^8.1.1",
"prettier": "^3.6.2",
Expand All @@ -90,6 +93,8 @@
"sass-loader": "^16.0.5",
"style-loader": "^4.0.0",
"terminal": "^0.1.4",
"ts-loader": "^9.5.4",
"typescript": "^5.9.3",
"webpack": "^5.101.0",
"webpack-cli": "^6.0.1"
},
Expand Down
22 changes: 22 additions & 0 deletions src/fileSystem/FileObjectBuilder.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { FileObject } from "./fileObject";
import { NativeFileWrapper } from "./NativeFileWrapper";
import { SAFDocumentFile } from "./SAFDocumentFile";

export class FileObjectBuilder {
async build(uri: string): Promise<FileObject | null> {
if (uri.startsWith("file://") || uri.startsWith("cdvfile://")) {
return new Promise<FileObject | null>((resolve, reject) => {
const wrapper = new NativeFileWrapper(uri, (nativeFile) => {
resolve(nativeFile);
});

// Catch errors from the async ready promise
wrapper.ready.catch(reject);
});
}
if (uri.startsWith("content://")) {
return new SAFDocumentFile(uri);
}
return null;
}
}
Loading