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
35a502f3
Commit
35a502f3
authored
Mar 03, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4238 from bergquist/mount_dist_folder
fix(plugins): fixes missed dist loading for plugindir
parents
430c3122
00dd0e8a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
19 deletions
+28
-19
pkg/plugins/plugins.go
+0
-6
pkg/util/filepath.go
+28
-13
No files found.
pkg/plugins/plugins.go
View file @
35a502f3
...
...
@@ -89,12 +89,6 @@ func scan(pluginDir string) error {
pluginPath
:
pluginDir
,
}
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"
{
log
.
Warn
(
"Could not scan dir
\"
%v
\"
error: %s"
,
pluginDir
,
err
)
...
...
pkg/util/filepath.go
View file @
35a502f3
...
...
@@ -80,35 +80,50 @@ func walk(path string, info os.FileInfo, resolvedPath string, symlinkPathsFollow
if
err
!=
nil
{
return
walkFn
(
resolvedPath
,
info
,
err
)
}
var
subFiles
=
make
([]
subFile
,
0
)
for
_
,
fileInfo
:=
range
list
{
path2
:=
filepath
.
Join
(
path
,
fileInfo
.
Name
())
var
resolvedPath2
string
if
resolvedPath
!=
""
{
resolvedPath2
=
filepath
.
Join
(
resolvedPath
,
fileInfo
.
Name
())
}
err
=
walk
(
path2
,
fileInfo
,
resolvedPath2
,
symlinkPathsFollowed
,
walkFn
)
subFiles
=
append
(
subFiles
,
subFile
{
path
:
path2
,
resolvedPath
:
resolvedPath2
,
fileInfo
:
fileInfo
})
}
if
containsDistFolder
(
subFiles
)
{
err
:=
walk
(
filepath
.
Join
(
path
,
"dist"
),
info
,
filepath
.
Join
(
resolvedPath
,
"dist"
),
symlinkPathsFollowed
,
walkFn
)
if
err
!=
nil
{
return
err
}
}
else
{
for
_
,
p
:=
range
subFiles
{
err
=
walk
(
p
.
path
,
p
.
fileInfo
,
p
.
resolvedPath
,
symlinkPathsFollowed
,
walkFn
)
if
err
!=
nil
{
return
err
}
}
}
return
nil
}
return
nil
}
func
ContainsDistFolder
(
path
string
)
bool
{
info
,
err
:=
os
.
Lstat
(
path
)
if
err
!=
nil
{
return
false
}
if
!
info
.
IsDir
()
{
return
false
}
type
subFile
struct
{
path
,
resolvedPath
string
fileInfo
os
.
FileInfo
}
list
,
err
:=
ioutil
.
ReadDir
(
path
)
for
_
,
fileInfo
:=
range
list
{
if
fileInfo
.
IsDir
()
&&
fileInfo
.
Name
()
==
"dist"
{
func
containsDistFolder
(
subFiles
[]
subFile
)
bool
{
for
_
,
p
:=
range
subFiles
{
if
p
.
fileInfo
.
IsDir
()
&&
p
.
fileInfo
.
Name
()
==
"dist"
{
return
true
}
}
...
...
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