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