func (s *GenerateBuildPathIfMissing) Run(ctx *types.Context) error {
	if ctx.BuildPath != "" {
		return nil
	}

	md5sum := utils.MD5Sum([]byte(ctx.SketchLocation))

	buildPath := filepath.Join(os.TempDir(), "arduino-sketch-"+strings.ToUpper(md5sum))
	_, err := os.Stat(buildPath)
	if err != nil && !os.IsNotExist(err) {
		return i18n.WrapError(err)
	}

	if ctx.DebugLevel > 5 {
		logger := ctx.GetLogger()
		logger.Fprintln(os.Stdout, constants.LOG_LEVEL_WARN, constants.MSG_SETTING_BUILD_PATH, buildPath)
	}

	ctx.BuildPath = buildPath

	return nil
}
func (s *GenerateBuildPathIfMissing) Run(context map[string]interface{}) error {
	if utils.MapHas(context, constants.CTX_BUILD_PATH) && context[constants.CTX_BUILD_PATH].(string) != constants.EMPTY_STRING {
		return nil
	}

	sketchLocation := context[constants.CTX_SKETCH_LOCATION].(string)
	md5sum := utils.MD5Sum([]byte(sketchLocation))

	buildPath := filepath.Join(os.TempDir(), "arduino-sketch-"+strings.ToUpper(md5sum))
	_, err := os.Stat(buildPath)
	if err != nil && !os.IsNotExist(err) {
		return utils.WrapError(err)
	}

	if utils.DebugLevel(context) > 5 {
		logger := context[constants.CTX_LOGGER].(i18n.Logger)
		logger.Fprintln(os.Stdout, constants.LOG_LEVEL_WARN, constants.MSG_SETTING_BUILD_PATH, buildPath)
	}

	context[constants.CTX_BUILD_PATH] = buildPath

	return nil
}