File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ async function run(
6060 const uuid = helpers . uuid ( ) ;
6161
6262 let isLoading = false ;
63+ let isFallback = false ;
6364 let filename , pathName , extension ;
6465 let port = appSettings . value . serverPort ;
6566 let EXECUTING_SCRIPT = uuid + "_script.js" ;
@@ -252,7 +253,7 @@ async function run(
252253
253254 let file = activeFile . SAFMode === "single" ? activeFile : null ;
254255
255- if ( pathName ) {
256+ if ( pathName && isFallback ) {
256257 const projectFolder = addedFolder [ 0 ] ;
257258
258259 //set the root folder to the file parent if no project folder is set
@@ -478,10 +479,20 @@ async function run(
478479 * @returns
479480 */
480481 async function sendFileContent ( url , id , mime , processText ) {
481- const fs = fsOperation ( url ) ;
482+ let fs = fsOperation ( url ) ;
482483
483484 if ( ! ( await fs . exists ( ) ) ) {
484- error ( id ) ;
485+ const xfs = fsOperation ( Url . join ( pathName , filename ) ) ;
486+
487+ if ( await xfs . exists ( ) ) {
488+ fs = xfs ;
489+ isFallback = true ;
490+ console . log ( `fallback ${ Url . join ( pathName , filename ) } ` ) ;
491+ } else {
492+ console . log ( `${ url } doesnt exists` ) ;
493+ error ( id ) ;
494+ }
495+
485496 return ;
486497 }
487498
You can’t perform that action at this time.
0 commit comments