File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -203,7 +203,10 @@ FS.staticInit();
203203 try {
204204 current = FS . lookupNode ( current , parts [ i ] ) ;
205205 } catch ( e ) {
206- if ( ( e ?. errno === { { { cDefs . ENOENT } } } ) && islast && opts . handleBrokenLink ) {
206+ // if noent_okay is true, suppress a ENOENT in the last component
207+ // and return an object with an undefined node. This is needed for
208+ // resolving symlinks in the path when creating a file.
209+ if ( ( e ?. errno === { { { cDefs . ENOENT } } } ) && islast && opts . noent_okay ) {
207210 return { path : current_path } ;
208211 }
209212 throw e ;
@@ -1038,9 +1041,12 @@ FS.staticInit();
10381041 node = path ;
10391042 } else {
10401043 path = PATH . normalize ( path ) ;
1044+ // noent_okay makes it so that if the final component of the path
1045+ // doesn't exist, lookupPath returns `node: undefined`. `path` will be
1046+ // updated to point to the target of all symlinks.
10411047 var lookup = FS . lookupPath ( path , {
10421048 follow : ! ( flags & { { { cDefs . O_NOFOLLOW } } } ) ,
1043- handleBrokenLink : true
1049+ noent_okay : true
10441050 } ) ;
10451051 node = lookup . node ;
10461052 path = lookup . path ;
You can’t perform that action at this time.
0 commit comments