File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed
src/server/node/modules/vfs Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -485,7 +485,33 @@ const VFS = {
485
485
486
486
scandir : function ( http , args , resolve , reject ) {
487
487
const resolved = _vfs . parseVirtualPath ( args . path , http ) ;
488
- readDir ( resolved . query , resolved . real ) . then ( resolve ) . catch ( reject ) ;
488
+ const opts = args . options || { } ;
489
+
490
+ readDir ( resolved . query , resolved . real ) . then ( function ( list ) {
491
+
492
+ if ( opts . shortcuts !== false ) {
493
+ const filename = typeof opts . shortcuts === 'string' ? opts . shortcuts . replace ( / \/ + g / , '' ) : '.shortcuts.json' ;
494
+ const path = args . path . replace ( / \/ ? $ / , '/' + filename ) ;
495
+ const realMeta = _vfs . parseVirtualPath ( path , http ) ;
496
+
497
+ _fs . readFile ( realMeta . real , function ( err , contents ) {
498
+ var additions = [ ] ;
499
+ if ( ! err ) {
500
+ try {
501
+ additions = JSON . parse ( contents . toString ( ) ) ;
502
+ if ( ! ( additions instanceof Array ) ) {
503
+ additions = [ ] ;
504
+ }
505
+ } catch ( e ) { }
506
+ }
507
+
508
+ resolve ( list . concat ( additions ) ) ;
509
+ } ) ;
510
+ } else {
511
+ resolve ( list ) ;
512
+ }
513
+
514
+ } ) . catch ( reject ) ;
489
515
} ,
490
516
491
517
freeSpace : function ( http , args , resolve , reject ) {
You can’t perform that action at this time.
0 commit comments