Skip to content

Commit

Permalink
Merge pull request #3566 from ActiveState/mitchell/dx-3137
Browse files Browse the repository at this point in the history
Localize an access denied error when attempting to migrate an activestate.yaml.
  • Loading branch information
mitchell-as authored Oct 30, 2024
2 parents f4c94aa + 6fba38b commit a7d4759
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/projectfile/yamlfield.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"regexp"

"github.com/ActiveState/cli/internal/errs"
"github.com/ActiveState/cli/internal/locale"
"github.com/ActiveState/cli/internal/osutils"
"gopkg.in/yaml.v2"
)

Expand Down Expand Up @@ -56,6 +58,11 @@ func (y *yamlField) Save(path string) error {
}

if err := os.WriteFile(path, out, 0664); err != nil {
if osutils.IsAccessDeniedError(err) {
return locale.WrapInputError(err, "err_migrate_projectfile_access_denied",
"Your project file at '{{.V0}}' is out of date, but State Tool does not have permission to update it. Please make it writeable or re-checkout the project to a writeable location.",
path)
}
return errs.Wrap(err, "ioutil.WriteFile %s failed", path)
}

Expand Down

0 comments on commit a7d4759

Please sign in to comment.