Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
b6417205
Commit
b6417205
authored
Mar 02, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:grafana/grafana
parents
950455bd
eb79436a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
2 deletions
+25
-2
pkg/plugins/plugins.go
+4
-0
pkg/util/filepath.go
+21
-2
No files found.
pkg/plugins/plugins.go
View file @
b6417205
...
...
@@ -90,6 +90,10 @@ func scan(pluginDir string) error {
}
log
.
Info
(
"Plugins: Scaning dir %s"
,
pluginDir
)
if
util
.
ContainsDistFolder
(
pluginDir
)
{
log
.
Info
(
"Plugins: Found dist folder in %s"
,
pluginDir
)
pluginDir
=
filepath
.
Join
(
pluginDir
,
"dist"
)
}
if
err
:=
util
.
Walk
(
pluginDir
,
true
,
true
,
scanner
.
walker
);
err
!=
nil
{
if
pluginDir
!=
"data/plugins"
{
...
...
pkg/util/filepath.go
View file @
b6417205
...
...
@@ -44,8 +44,7 @@ func Walk(path string, followSymlinks bool, detectSymlinkInfiniteLoop bool, walk
//
//If resolvedPath is "", then we are not following symbolic links.
//If symlinkPathsFollowed is not nil, then we need to detect infinite loop.
func
walk
(
path
string
,
info
os
.
FileInfo
,
resolvedPath
string
,
symlinkPathsFollowed
map
[
string
]
bool
,
walkFn
WalkFunc
)
error
{
func
walk
(
path
string
,
info
os
.
FileInfo
,
resolvedPath
string
,
symlinkPathsFollowed
map
[
string
]
bool
,
walkFn
WalkFunc
)
error
{
if
info
==
nil
{
return
errors
.
New
(
"Walk: Nil FileInfo passed"
)
}
...
...
@@ -96,3 +95,23 @@ func walk(path string, info os.FileInfo, resolvedPath string,
}
return
nil
}
func
ContainsDistFolder
(
path
string
)
bool
{
info
,
err
:=
os
.
Lstat
(
path
)
if
err
!=
nil
{
return
false
}
if
!
info
.
IsDir
()
{
return
false
}
list
,
err
:=
ioutil
.
ReadDir
(
path
)
for
_
,
fileInfo
:=
range
list
{
if
fileInfo
.
IsDir
()
&&
fileInfo
.
Name
()
==
"dist"
{
return
true
}
}
return
false
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment