MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / addRoot

Function addRoot

src/lib/fileList.js:229–246  ·  view source on GitHub ↗
({ url, name })

Source from the content-addressed store, hash-verified

227 * @param {{url: string, name: string}} folder - Folder path
228 */
229export async function addRoot({ url, name }) {
230 try {
231 const TERMUX_STORAGE =
232 "content://com.termux.documents/tree/%2Fdata%2Fdata%2Fcom.termux%2Ffiles%2Fhome::/data/data/com.termux/files/home/storage";
233 const TERMUX_SHARED =
234 "content://com.termux.documents/tree/%2Fdata%2Fdata%2Fcom.termux%2Ffiles%2Fhome::/data/data/com.termux/files/home/storage/shared";
235 if (url === TERMUX_STORAGE) return;
236 if (url === TERMUX_SHARED) return;
237
238 const tree = await Tree.createRoot(url, name);
239 filesTree[url] = tree;
240 trackScan(getAllFiles(tree, null, { indexContent: false }));
241 emit("add-folder", tree);
242 } catch (error) {
243 // ignore
244 window.log("error", error);
245 }
246}
247
248/**
249 * Called when a folder is removed

Callers

nothing calls this directly

Calls 5

trackScanFunction · 0.85
getAllFilesFunction · 0.85
createRootMethod · 0.80
logMethod · 0.80
emitFunction · 0.70

Tested by

no test coverage detected