MCPcopy Create free account
hub / github.com/GoMudEngine/GoMud / DeleteMutatorSpec

Function DeleteMutatorSpec

internal/mutators/admin.go:124–139  ·  view source on GitHub ↗
(mutatorId string)

Source from the content-addressed store, hash-verified

122}
123
124func DeleteMutatorSpec(mutatorId string) error {
125 spec := GetMutatorSpec(mutatorId)
126 if spec == nil {
127 return fmt.Errorf("mutator not found: %s", mutatorId)
128 }
129
130 basePath := util.FilePath(configs.GetFilePathsConfig().DataFiles.String() + `/mutators/`)
131
132 yamlPath := basePath + spec.Filepath()
133 if err := os.Remove(yamlPath); err != nil && !os.IsNotExist(err) {
134 return fmt.Errorf("removing mutator yaml: %w", err)
135 }
136
137 delete(allMutators, mutatorId)
138 return nil
139}

Callers 1

apiV1DeleteMutatorFunction · 0.92

Calls 7

FilePathFunction · 0.92
GetFilePathsConfigFunction · 0.92
GetMutatorSpecFunction · 0.85
deleteFunction · 0.85
StringMethod · 0.65
FilepathMethod · 0.65
RemoveMethod · 0.45

Tested by

no test coverage detected