@@ -245,23 +245,24 @@ func (lm *LibrariesManager) loadLibrariesFromDir(librariesDir *LibrariesDir) []*
245
245
loadedLibs = append (loadedLibs , library )
246
246
}
247
247
248
- // Write lib cache
249
- cache , err := cacheFilePath .Create ()
250
- if err != nil {
251
- s := status .Newf (codes .FailedPrecondition , "creating lib cache %[1]s: %[2]s" , cacheFilePath , err )
252
- return append (statuses , s )
253
- }
254
248
// Preload source files and header
255
249
for _ , lib := range loadedLibs {
256
250
lib .SourceHeaders ()
257
251
}
258
- // Write the cache
259
- err = loadedLibs .MarshalBinary (cache , librariesDir .Path )
260
- cache .Close ()
261
- if err != nil {
262
- cacheFilePath .Remove ()
263
- s := status .Newf (codes .FailedPrecondition , "writing lib cache %[1]s: %[2]s" , cacheFilePath , err )
264
- return append (statuses , s )
252
+ if librariesDir .Location != libraries .Unmanaged {
253
+ // Write lib cache
254
+ cache , err := cacheFilePath .Create ()
255
+ if err != nil {
256
+ s := status .Newf (codes .FailedPrecondition , "creating lib cache %[1]s: %[2]s" , cacheFilePath , err )
257
+ return append (statuses , s )
258
+ }
259
+ err = loadedLibs .MarshalBinary (cache , librariesDir .Path )
260
+ cache .Close ()
261
+ if err != nil {
262
+ cacheFilePath .Remove ()
263
+ s := status .Newf (codes .FailedPrecondition , "writing lib cache %[1]s: %[2]s" , cacheFilePath , err )
264
+ return append (statuses , s )
265
+ }
265
266
}
266
267
}
267
268
0 commit comments