Plugins: Compose filesystem paths with filepath.Join (#28375)

* plugins: Fix filesystem path composition

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* plugins: Use filepath.Join to join filesystem paths

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
Arve Knudsen
2020-10-19 17:35:31 +02:00
committed by GitHub
parent 762a7195a6
commit 89d10c706a
8 changed files with 16 additions and 17 deletions

View File

@ -54,8 +54,8 @@ func (fp *FrontendPluginBase) setPathsBasedOnApp(app *AppPlugin) {
func (fp *FrontendPluginBase) handleModuleDefaults() {
if isExternalPlugin(fp.PluginDir) {
fp.Module = path.Join("plugins", fp.Id, "module")
fp.BaseUrl = path.Join("public/plugins", fp.Id)
fp.Module = filepath.Join("plugins", fp.Id, "module")
fp.BaseUrl = filepath.Join("public/plugins", fp.Id)
return
}
@ -66,8 +66,8 @@ func (fp *FrontendPluginBase) handleModuleDefaults() {
currentDir := filepath.Base(fp.PluginDir)
// use path package for the following statements
// because these are not file paths
fp.Module = path.Join("app/plugins", fp.Type, currentDir, "module")
fp.BaseUrl = path.Join("public/app/plugins", fp.Type, currentDir)
fp.Module = filepath.Join("app/plugins", fp.Type, currentDir, "module")
fp.BaseUrl = filepath.Join("public/app/plugins", fp.Type, currentDir)
}
func isExternalPlugin(pluginDir string) bool {