File tree Expand file tree Collapse file tree 1 file changed +24
-4
lines changed Expand file tree Collapse file tree 1 file changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -8,17 +8,37 @@ import (
8
8
"github.com/codegangsta/cli"
9
9
"github.com/grafana/grafana/pkg/cmd/grafana-cli/commands"
10
10
"github.com/grafana/grafana/pkg/cmd/grafana-cli/log"
11
+ "strings"
11
12
)
12
13
13
14
var version = "master"
14
15
15
16
func getGrafanaPluginDir () string {
16
- os := runtime .GOOS
17
- if os == "windows" {
17
+ currentOS := runtime .GOOS
18
+ defaultNix := "/var/lib/grafana/plugins"
19
+
20
+ if currentOS == "windows" {
18
21
return "C:\\ opt\\ grafana\\ plugins"
19
- } else {
20
- return "/var/lib/grafana/plugins"
21
22
}
23
+
24
+ pwd , err := os .Getwd ()
25
+
26
+ if err != nil {
27
+ log .Error ("Could not get current path. using default" )
28
+ return defaultNix
29
+ }
30
+
31
+ if isDevenvironment (pwd ) {
32
+ return "../../../data/plugins"
33
+ }
34
+
35
+ return defaultNix
36
+ }
37
+
38
+ 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" )
22
42
}
23
43
24
44
func main () {
You can’t perform that action at this time.
0 commit comments