Use fs methods
This commit is contained in:
parent
6a4e1cfaf1
commit
c012e3b504
|
@ -26,7 +26,7 @@ func InitTemplateStringsFS(filesystem fs.FS, stringsDir string, fileExt string,
|
||||||
defaultVariant,
|
defaultVariant,
|
||||||
}
|
}
|
||||||
// Check directory
|
// Check directory
|
||||||
if stat, err := os.Stat(stringsDir); err != nil {
|
if stat, err := fs.Stat(filesystem, stringsDir); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else if !stat.IsDir() {
|
} else if !stat.IsDir() {
|
||||||
return nil, errors.New("specified directory is no dir")
|
return nil, errors.New("specified directory is no dir")
|
||||||
|
@ -42,7 +42,7 @@ func InitTemplateStringsFS(filesystem fs.FS, stringsDir string, fileExt string,
|
||||||
if _, ok := ts.templateStrings[variant]; ok {
|
if _, ok := ts.templateStrings[variant]; ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
fb, err := os.ReadFile(filepath.Join(stringsDir, variant+fileExt))
|
fb, err := fs.ReadFile(filesystem, filepath.Join(stringsDir, variant+fileExt))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Just ignore the file
|
// Just ignore the file
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue