Skip to content

Commit a5eda6a

Browse files
committed
feat(cli): detects plugin folder for dev env
closes grafana#4572
1 parent 01c6b56 commit a5eda6a

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

pkg/cmd/grafana-cli/main.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"github.com/codegangsta/cli"
99
"github.com/grafana/grafana/pkg/cmd/grafana-cli/commands"
1010
"github.com/grafana/grafana/pkg/cmd/grafana-cli/log"
11-
"strings"
1211
)
1312

1413
var version = "master"
@@ -18,7 +17,7 @@ func getGrafanaPluginDir() string {
1817
defaultNix := "/var/lib/grafana/plugins"
1918

2019
if currentOS == "windows" {
21-
return "C:\\opt\\grafana\\plugins"
20+
return "..\\data\\plugins"
2221
}
2322

2423
pwd, err := os.Getwd()
@@ -29,16 +28,16 @@ func getGrafanaPluginDir() string {
2928
}
3029

3130
if isDevenvironment(pwd) {
32-
return "../../../data/plugins"
31+
return "../data/plugins"
3332
}
3433

3534
return defaultNix
3635
}
3736

3837
func isDevenvironment(pwd string) bool {
39-
// if grafana-cli is executed from the cmd folder we can assume
40-
// that its in development environment.
41-
return strings.HasSuffix(pwd, "/pkg/cmd/grafana-cli")
38+
// if ../conf/default.ini exists, grafana is not installed as package
39+
_, err := os.Stat("../conf/default.ini")
40+
return err != nil
4241
}
4342

4443
func main() {

0 commit comments

Comments
 (0)