File tree Expand file tree Collapse file tree 2 files changed +33
-48
lines changed
Expand file tree Collapse file tree 2 files changed +33
-48
lines changed Original file line number Diff line number Diff line change @@ -507,6 +507,22 @@ async function run(
507507 } ) ;
508508 }
509509
510+ function makeUriAbsoluteIfNeeded ( uri ) {
511+ const termuxRootEncoded =
512+ "content://com.termux.documents/tree/%2Fdata%2Fdata%2Fcom.termux%2Ffiles%2Fhome" ;
513+ const termuxRootDecoded = "/data/data/com.termux/files/home" ;
514+
515+ if ( uri . startsWith ( termuxRootEncoded ) ) {
516+ // Extract subpath after `::` if already absolute
517+ if ( uri . includes ( "::" ) ) return uri ;
518+
519+ const decodedPath = decodeURIComponent ( uri . split ( "tree/" ) [ 1 ] || "" ) ;
520+ return `${ termuxRootEncoded } ::${ decodedPath } /` ;
521+ }
522+
523+ return uri ;
524+ }
525+
510526 function getRelativePath ( ) {
511527 // Get the project url
512528 const projectFolder = addedFolder [ 0 ] ;
@@ -518,13 +534,7 @@ async function run(
518534 }
519535
520536 //make the uri absolute if necessary
521- if (
522- rootFolder ===
523- "content://com.termux.documents/tree/%2Fdata%2Fdata%2Fcom.termux%2Ffiles%2Fhome"
524- ) {
525- rootFolder =
526- "content://com.termux.documents/tree/%2Fdata%2Fdata%2Fcom.termux%2Ffiles%2Fhome::/data/data/com.termux/files/home/" ;
527- }
537+ rootFolder = makeUriAbsoluteIfNeeded ( rootFolder ) ;
528538
529539 console . log ( "rootFolder" , rootFolder ) ;
530540 console . log ( "pathName" , pathName ) ;
You can’t perform that action at this time.
0 commit comments