@@ -81,23 +81,21 @@ function mt:loadFile(uri, libraryUri)
8181 if files .getFile (uri ) then
8282 self .read = self .read + 1
8383 self :update ()
84- self ._cache [uri ] = true
85- files .addRef (uri )
8684 log .info ((' Skip loaded file: %s' ):format (uri ))
87- return
88- end
89- local content = pub .awaitTask (' loadFile' , furi .decode (uri ))
90- self .read = self .read + 1
91- self :update ()
92- if not content then
93- return
94- end
95- if self ._cache [uri ] then
96- return
85+ else
86+ local content = pub .awaitTask (' loadFile' , furi .decode (uri ))
87+ if self ._cache [uri ] then
88+ return
89+ end
90+ self ._cache [uri ] = true
91+ self .read = self .read + 1
92+ self :update ()
93+ if not content then
94+ return
95+ end
96+ log .info ((' Preload file at: %s , size = %.3f KB' ):format (uri , # content / 1024.0 ))
97+ files .setText (uri , content , false )
9798 end
98- log .info ((' Preload file at: %s , size = %.3f KB' ):format (uri , # content / 1024.0 ))
99- self ._cache [uri ] = true
100- files .setText (uri , content , false )
10199 files .addRef (uri )
102100 if libraryUri then
103101 log .info (' ++++As library of:' , libraryUri )
@@ -112,23 +110,21 @@ function mt:loadFile(uri, libraryUri)
112110 if files .getFile (uri ) then
113111 self .read = self .read + 1
114112 self :update ()
115- self ._cache [uri ] = true
116- files .addRef (uri )
117113 log .info ((' Skip loaded file: %s' ):format (uri ))
118- return
119- end
120- local content = pub .awaitTask (' loadFile' , furi .decode (uri ))
121- self .read = self .read + 1
122- self :update ()
123- if not content then
124- return
125- end
126- if self ._cache [uri ] then
127- return
114+ else
115+ local content = pub .awaitTask (' loadFile' , furi .decode (uri ))
116+ if self ._cache [uri ] then
117+ return
118+ end
119+ self ._cache [uri ] = true
120+ self .read = self .read + 1
121+ self :update ()
122+ if not content then
123+ return
124+ end
125+ log .info ((' Preload dll at: %s , size = %.3f KB' ):format (uri , # content / 1024.0 ))
126+ files .saveDll (uri , content )
128127 end
129- log .info ((' Preload dll at: %s , size = %.3f KB' ):format (uri , # content / 1024.0 ))
130- self ._cache [uri ] = true
131- files .saveDll (uri , content )
132128 files .addRef (uri )
133129 if libraryUri then
134130 log .info (' ++++As library of:' , libraryUri )
0 commit comments