@@ -84,6 +84,7 @@ define([
8484 this . currentFileList = [ ] ;
8585
8686 this . pathState = {
87+ parentPath : '' ,
8788 currentPath : '' ,
8889 baseFolder : '' , // root folder name
8990 relativeDir : '' , // root folder name
@@ -257,9 +258,24 @@ define([
257258 let fileList = this . currentFileList ;
258259 // clear body
259260 $ ( this . wrapSelector ( '.fileNavigationPage-body' ) ) . html ( '' ) ;
261+
260262 // render file items
261263 let dirArr = [ ] ;
262264 let fileArr = [ ] ;
265+
266+ // render upper folder
267+ if ( that . pathState . parentPath != '' ) {
268+ let upperFolderTag = that . renderFileItem ( {
269+ name : '..' ,
270+ type : 'dir' ,
271+ path : that . pathState . parentPath ,
272+ size : '' ,
273+ atime : '' ,
274+ mtime : ''
275+ } ) ;
276+ dirArr . push ( upperFolderTag ) ;
277+ }
278+
263279 fileList && fileList . forEach ( ( file , idx ) => {
264280 if ( idx == 0 ) return ;
265281 let fileTag = that . renderFileItem ( file ) ;
@@ -400,15 +416,15 @@ define([
400416 let selectedExt = $ ( that . wrapSelector ( '#vp_fileNavigationExt' ) ) . val ( ) ;
401417 let fileExtIdx = fileName . lastIndexOf ( '.' ) ;
402418 // if no extension, add it
403- if ( fileExtIdx < 0 || fileName . substring ( fileExtIdx + 1 ) != selectedExt ) {
419+ if ( selectedExt != '' && ( fileExtIdx < 0 || fileName . substring ( fileExtIdx + 1 ) != selectedExt ) ) {
404420 fileName += '.' + selectedExt ;
405421 }
406422 // no path, set it
407423 if ( filePath == '' ) {
408424 filePath = './' + fileName ;
409425 }
410426 fileExtIdx = filePath . lastIndexOf ( '.' ) ;
411- if ( fileExtIdx < 0 || filePath . substring ( fileExtIdx + 1 ) != selectedExt ) {
427+ if ( selectedExt != '' && ( fileExtIdx < 0 || filePath . substring ( fileExtIdx + 1 ) != selectedExt ) ) {
412428 filePath += '.' + selectedExt ;
413429 }
414430
@@ -569,8 +585,15 @@ define([
569585 } ) ;
570586 }
571587
588+ vpLog . display ( VP_LOG_TYPE . DEVELOP , 'FileNavigation - getFileList: ' , filtered_varList ) ;
572589
573590 var { currentDirStr, currentRelativePathStr } = that . splitPathStrAndSetStack ( dirObj , filtered_varList ) ;
591+ if ( filtered_varList [ 0 ] . current === filtered_varList [ 0 ] . parent ) {
592+ // no parent
593+ that . pathState . parentPath = '' ;
594+ } else {
595+ that . pathState . parentPath = filtered_varList [ 0 ] . parent ; // parent path
596+ }
574597 that . pathState . relativeDir = currentRelativePathStr ;
575598 that . pathState . currentPath = currentDirStr ;
576599 that . currentFileList = filtered_varList ;
0 commit comments