MCPcopy Create free account
hub / github.com/openclaw/gogcli / hydrateRuntimeLayoutFromConfig

Function hydrateRuntimeLayoutFromConfig

internal/cmd/runtime.go:273–293  ·  view source on GitHub ↗
(runtime *app.Runtime)

Source from the content-addressed store, hash-verified

271}
272
273func hydrateRuntimeLayoutFromConfig(runtime *app.Runtime) error {
274 if runtime.Config == nil {
275 return nil
276 }
277
278 storeLayout := runtime.Config.Layout()
279 if runtime.Layout.ConfigDir != "" &&
280 storeLayout.ConfigDir != "" &&
281 runtime.Layout.ConfigDir != storeLayout.ConfigDir {
282 return fmt.Errorf("%w: runtime=%s config_store=%s",
283 errRuntimeLayoutMismatch, runtime.Layout.ConfigDir, storeLayout.ConfigDir)
284 }
285
286 mergeLayoutKind(&runtime.Layout, storeLayout, config.PathKindConfig)
287 mergeLayoutKind(&runtime.Layout, storeLayout, config.PathKindData)
288 mergeLayoutKind(&runtime.Layout, storeLayout, config.PathKindState)
289 mergeLayoutKind(&runtime.Layout, storeLayout, config.PathKindCache)
290 runtime.Layout.UsesXDG = runtime.Layout.UsesXDG || storeLayout.UsesXDG
291 runtime.Layout.UsesXDGState = runtime.Layout.UsesXDGState || storeLayout.UsesXDGState
292 return nil
293}
294
295func mergeLayoutKind(target *config.Layout, source config.Layout, kind config.PathKind) {
296 targetDir, _ := target.Dir(kind)

Callers 2

configureRuntimeConfigFunction · 0.85
configureRuntimeLayoutFunction · 0.85

Calls 3

mergeLayoutKindFunction · 0.85
ErrorfMethod · 0.80
LayoutMethod · 0.45

Tested by

no test coverage detected