1
Fork 0

Use fs methods

This commit is contained in:
Jan-Lukas Else 2022-02-11 10:57:02 +01:00
parent 6a4e1cfaf1
commit c012e3b504
1 changed files with 2 additions and 2 deletions

View File

@ -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