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

Function getTargetUri

src/utils/helpers.js:412–443  ·  view source on GitHub ↗
(baseUri, name, index)

Source from the content-addressed store, hash-verified

410 ? decodeURIComponent(treeSegment.split("::")[0] || "")
411 : "";
412 const getTargetUri = (baseUri, name, index) => {
413 if (
414 !(isExternalStorageUri || isTermuxUri || isAcodeTerminalPublicSafUri)
415 ) {
416 return Url.join(baseUri, name);
417 }
418
419 let fullUri = baseUri;
420 if (isExternalStorageUri) {
421 if (!isSpecialCase && index === 0) {
422 fullUri += `::primary:${baseFolder}/${name}`;
423 } else {
424 fullUri += `/${name}`;
425 }
426 } else if (isTermuxUri) {
427 if (!isSpecialCase && index === 0) {
428 fullUri += `::/data/data/com.termux/files/home/${name}`;
429 } else {
430 fullUri += `/${name}`;
431 }
432 } else if (isAcodeTerminalPublicSafUri) {
433 if (!isSpecialCase && index === 0) {
434 const sanitizedBase = terminalBasePath.endsWith("/")
435 ? `${terminalBasePath}${name}`
436 : `${terminalBasePath}/${name}`;
437 fullUri += `::${sanitizedBase}`;
438 } else {
439 fullUri += `/${name}`;
440 }
441 }
442 return fullUri;
443 };
444 const getExpectedType = (isLastPart) =>
445 isLastPart && isFile ? "file" : "folder";
446 const ensureEntry = async (baseUri, targetUri, name, expectedType) => {

Callers 1

createFileStructureFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected