Skip to content

Commit

Permalink
Fix config folder permissions on create
Browse files Browse the repository at this point in the history
  • Loading branch information
James Belleau committed Sep 24, 2024
1 parent 058ea6c commit d264222
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const (
)

const (
// permission for user to read/write.
// permission for user to read/write/execute.
USER_READ_WRITE_EXECUTE_PERM = 0700
)

Expand Down Expand Up @@ -152,7 +152,7 @@ func SetupConfigFolder() error {
return err
}
if _, err := os.Stat(grantedFolder); os.IsNotExist(err) {
err := os.Mkdir(grantedFolder, USER_READ_WRITE_PERM)
err := os.Mkdir(grantedFolder, USER_READ_WRITE_EXECUTE_PERM)
if err != nil {
return err
}
Expand Down
7 changes: 6 additions & 1 deletion pkg/frecency/frecency.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ const (
USER_READ_WRITE_PERM = 0644
)

const (
// permission for user to read/write/execute.
USER_READ_WRITE_EXECUTE_PERM = 0700
)

// change these to play with the weights
// values between 0 and 1
// 0 will exclude the metric all together from the ordering
Expand Down Expand Up @@ -75,7 +80,7 @@ func Load(fecencyStoreKey string) (*FrecencyStore, error) {

// check if the providers file exists
if _, err = os.Stat(c.path); os.IsNotExist(err) {
err := os.MkdirAll(configFolder, USER_READ_WRITE_PERM)
err := os.MkdirAll(configFolder, USER_READ_WRITE_EXECUTE_PERM)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit d264222

Please sign in to comment.