refactor: allow setting more options when changing permissions on a file

Rather than hardcoding paths, just allow them to be options.
This commit is contained in:
Jose Diaz-Gonzalez
2024-01-30 07:31:02 -05:00
parent 6622de5998
commit a277c5da1b
5 changed files with 88 additions and 50 deletions

View File

@@ -13,11 +13,10 @@ func CreateAppDataDirectory(pluginName, appName string) error {
return err
}
if err := SetPermissions(directory, 0755); err != nil {
return err
}
return nil
return SetPermissions(SetPermissionInput{
Filename: directory,
Mode: os.FileMode(0755),
})
}
// CreateDataDirectory creates a data directory for the given plugin/app combination with the correct permissions
@@ -27,11 +26,10 @@ func CreateDataDirectory(pluginName string) error {
return err
}
if err := SetPermissions(directory, 0755); err != nil {
return err
}
return nil
return SetPermissions(SetPermissionInput{
Filename: directory,
Mode: os.FileMode(0755),
})
}
// GetAppDataDirectory returns the path to the data directory for the given plugin/app combination