@@ -141,18 +141,19 @@ func Create(req *rpc.CreateRequest, extraUserAgent ...string) (*rpc.CreateRespon
141
141
)
142
142
143
143
// Create library manager and add libraries directories
144
- instance . lm = librariesmanager .NewLibraryManager (
144
+ lm : = librariesmanager .NewLibraryManager (
145
145
dataDir ,
146
146
downloadsDir ,
147
147
)
148
+ instance .lm = lm
148
149
149
150
// Add directories of libraries bundled with IDE
150
151
if bundledLibsDir := configuration .IDEBundledLibrariesDir (configuration .Settings ); bundledLibsDir != nil {
151
- instance . lm .AddLibrariesDir (bundledLibsDir , libraries .IDEBuiltIn )
152
+ lm .AddLibrariesDir (bundledLibsDir , libraries .IDEBuiltIn )
152
153
}
153
154
154
155
// Add libraries directory from config file
155
- instance . lm .AddLibrariesDir (
156
+ lm .AddLibrariesDir (
156
157
configuration .LibrariesDir (configuration .Settings ),
157
158
libraries .User ,
158
159
)
@@ -289,21 +290,23 @@ func Init(req *rpc.InitRequest, responseCallback func(r *rpc.InitResponse)) erro
289
290
responseError (s .ToRPCStatus ())
290
291
}
291
292
293
+ lm := instance .lm
294
+
292
295
// Load libraries
293
296
for _ , pack := range instance .PackageManager .Packages {
294
297
for _ , platform := range pack .Platforms {
295
298
if platformRelease := instance .PackageManager .GetInstalledPlatformRelease (platform ); platformRelease != nil {
296
- instance . lm .AddPlatformReleaseLibrariesDir (platformRelease , libraries .PlatformBuiltIn )
299
+ lm .AddPlatformReleaseLibrariesDir (platformRelease , libraries .PlatformBuiltIn )
297
300
}
298
301
}
299
302
}
300
303
301
- if err := instance . lm .LoadIndex (); err != nil {
304
+ if err := lm .LoadIndex (); err != nil {
302
305
s := status .Newf (codes .FailedPrecondition , tr ("Loading index file: %v" ), err )
303
306
responseError (s )
304
307
}
305
308
306
- for _ , err := range instance . lm .RescanLibraries () {
309
+ for _ , err := range lm .RescanLibraries () {
307
310
s := status .Newf (codes .FailedPrecondition , tr ("Loading libraries: %v" ), err )
308
311
responseError (s )
309
312
}
0 commit comments