mirror of
https://github.com/Theodor-Springmann-Stiftung/kgpz_web.git
synced 2025-10-29 17:15:31 +00:00
Better structure of files; introduced XML models
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/xml"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/Theodor-Springmann-Stiftung/kgpz_web/helpers/logging"
|
||||
)
|
||||
@@ -30,3 +31,13 @@ func UnmarshalFile[T any](filename string, data T) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func XMLFilesForPath(path string) ([]string, error) {
|
||||
if _, err := os.Stat(path); os.IsNotExist(err) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
matches, err := filepath.Glob(filepath.Join(path, "*.xml"))
|
||||
|
||||
return matches, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user