[MM-14576] Add GetBundlePath method to Plugin API (#10466)
* Fix typo * Add GetBundlePath method to Plugin API * Change signature to GetBundlePath() (string, error) * Add test
Этот коммит содержится в:
коммит произвёл
Jesse Hallam
родитель
16a9489bbb
Коммит
030ba52b08
@@ -8,6 +8,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/mattermost/mattermost-server/mlog"
|
||||
@@ -98,6 +99,15 @@ func (api *PluginAPI) SavePluginConfig(pluginConfig map[string]interface{}) *mod
|
||||
return api.app.SaveConfig(cfg, true)
|
||||
}
|
||||
|
||||
func (api *PluginAPI) GetBundlePath() (string, error) {
|
||||
bundlePath, err := filepath.Abs(filepath.Join(*api.GetConfig().PluginSettings.Directory, api.manifest.Id))
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return bundlePath, err
|
||||
}
|
||||
|
||||
func (api *PluginAPI) GetLicense() *model.License {
|
||||
return api.app.License()
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user