]> git.lizzy.rs Git - micro.git/blobdiff - internal/config/rtfiles.go
Perl syntax improvement (#2359)
[micro.git] / internal / config / rtfiles.go
index 09e9176883cbabc712d3ce3f5dca33cf18aaa4ff..397a85398dc049624b653c2d622e347c0a483625 100644 (file)
@@ -9,6 +9,8 @@ import (
        "path/filepath"
        "regexp"
        "strings"
+
+       rt "github.com/zyedidia/micro/v2/runtime"
 )
 
 const (
@@ -90,7 +92,7 @@ func (af assetFile) Name() string {
 }
 
 func (af assetFile) Data() ([]byte, error) {
-       return Asset(string(af))
+       return rt.Asset(string(af))
 }
 
 func (nf namedFile) Name() string {
@@ -123,7 +125,7 @@ func AddRuntimeFilesFromDirectory(fileType RTFiletype, directory, pattern string
 // AddRuntimeFilesFromAssets registers each file from the given asset-directory for
 // the filetype which matches the file-pattern
 func AddRuntimeFilesFromAssets(fileType RTFiletype, directory, pattern string) {
-       files, err := AssetDir(directory)
+       files, err := rt.AssetDir(directory)
        if err != nil {
                return
        }
@@ -199,7 +201,6 @@ func InitRuntimeFiles() {
                                        }
                                        p.Info, err = NewPluginInfo(data)
                                        if err != nil {
-                                               log.Println(err)
                                                continue
                                        }
                                        p.Name = p.Info.Name
@@ -215,9 +216,9 @@ func InitRuntimeFiles() {
        }
 
        plugdir = filepath.Join("runtime", "plugins")
-       if files, err := AssetDir(plugdir); err == nil {
+       if files, err := rt.AssetDir(plugdir); err == nil {
                for _, d := range files {
-                       if srcs, err := AssetDir(filepath.Join(plugdir, d)); err == nil {
+                       if srcs, err := rt.AssetDir(filepath.Join(plugdir, d)); err == nil {
                                p := new(Plugin)
                                p.Name = d
                                p.DirName = d
@@ -226,13 +227,12 @@ func InitRuntimeFiles() {
                                        if strings.HasSuffix(f, ".lua") {
                                                p.Srcs = append(p.Srcs, assetFile(filepath.Join(plugdir, d, f)))
                                        } else if strings.HasSuffix(f, ".json") {
-                                               data, err := Asset(filepath.Join(plugdir, d, f))
+                                               data, err := rt.Asset(filepath.Join(plugdir, d, f))
                                                if err != nil {
                                                        continue
                                                }
                                                p.Info, err = NewPluginInfo(data)
                                                if err != nil {
-                                                       log.Println(err)
                                                        continue
                                                }
                                                p.Name = p.Info.Name