func (s *WipeoutBuildPathIfBuildOptionsChanged) Run(ctx *types.Context) error { if ctx.BuildOptionsJsonPrevious == "" { return nil } buildOptionsJson := ctx.BuildOptionsJson previousBuildOptionsJson := ctx.BuildOptionsJsonPrevious logger := ctx.GetLogger() var opts properties.Map var prevOpts properties.Map json.Unmarshal([]byte(buildOptionsJson), &opts) json.Unmarshal([]byte(previousBuildOptionsJson), &prevOpts) // If SketchLocation path is different but filename is the same, consider it equal if filepath.Base(opts["sketchLocation"]) == filepath.Base(prevOpts["sketchLocation"]) { delete(opts, "sketchLocation") delete(prevOpts, "sketchLocation") } if opts.Equals(prevOpts) { return nil } logger.Println(constants.LOG_LEVEL_INFO, constants.MSG_BUILD_OPTIONS_CHANGED) buildPath := ctx.BuildPath files, err := gohasissues.ReadDir(buildPath) if err != nil { return i18n.WrapError(err) } for _, file := range files { os.RemoveAll(filepath.Join(buildPath, file.Name())) } return nil }