File tree Expand file tree Collapse file tree 1 file changed +27
-13
lines changed
plugins/local-storage/src Expand file tree Collapse file tree 1 file changed +27
-13
lines changed Original file line number Diff line number Diff line change @@ -83,12 +83,19 @@ class LocalDatabase implements IPluginStorage {
8383 files ,
8484 ( file2 , cb ) => {
8585 if ( validateName ( file2 ) ) {
86- const item = {
87- name : `${ file } /${ file2 } ` ,
88- path : Path . resolve ( base , storage , file , file2 )
89- } ;
90-
91- onPackage ( item , cb ) ;
86+ const packagePath = Path . resolve ( base , storage , file , file2 ) ;
87+
88+ fs . stat ( packagePath , ( err , stats ) => {
89+ if ( _ . isNil ( err ) === false ) {
90+ return cb ( err ) ;
91+ }
92+ const item = {
93+ name : `${ file } /${ file2 } ` ,
94+ path : packagePath ,
95+ time : stats . mtime . getTime ( )
96+ } ;
97+ onPackage ( item , cb ) ;
98+ } ) ;
9299 } else {
93100 cb ( ) ;
94101 }
@@ -97,13 +104,20 @@ class LocalDatabase implements IPluginStorage {
97104 ) ;
98105 } ) ;
99106 } else if ( validateName ( file ) ) {
100- onPackage (
101- {
102- name : file ,
103- path : Path . resolve ( base , storage , file )
104- } ,
105- cb
106- ) ;
107+ const packagePath = Path . resolve ( base , storage , file ) ;
108+ fs . stat ( packagePath , ( err , stats ) => {
109+ if ( _ . isNil ( err ) === false ) {
110+ return cb ( err ) ;
111+ }
112+ onPackage (
113+ {
114+ name : file ,
115+ path : packagePath ,
116+ time : stats . mtime . getTime ( )
117+ } ,
118+ cb
119+ ) ;
120+ } ) ;
107121 } else {
108122 cb ( ) ;
109123 }
You can’t perform that action at this time.
0 commit comments