MCPcopy
hub / github.com/loft-sh/devpod / markerFileExists

Function markerFileExists

pkg/devcontainer/setup/setup.go:320–337  ·  view source on GitHub ↗
(markerName string, markerContent string)

Source from the content-addressed store, hash-verified

318}
319
320func markerFileExists(markerName string, markerContent string) (bool, error) {
321 markerName = filepath.Join("/var/devpod", markerName+".marker")
322 t, err := os.ReadFile(markerName)
323 if err != nil && !os.IsNotExist(err) {
324 return false, err
325 } else if err == nil && (markerContent == "" || string(t) == markerContent) {
326 return true, nil
327 }
328
329 // write marker
330 _ = os.MkdirAll(filepath.Dir(markerName), 0777)
331 err = os.WriteFile(markerName, []byte(markerContent), 0644)
332 if err != nil {
333 return false, errors.Wrap(err, "write marker")
334 }
335
336 return false, nil
337}

Callers 6

ChownWorkspaceFunction · 0.85
PatchEtcProfileFunction · 0.85
PatchEtcEnvironmentFlagsFunction · 0.85
PatchEtcEnvironmentFunction · 0.85
SetupKubeConfigFunction · 0.85
runFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected