skip unsupported files
This commit is contained in:
@@ -42,7 +42,12 @@ func Sort(dst, path string) {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Handle single file
|
||||
if !info.IsDir() {
|
||||
if !fileSupported(path) {
|
||||
slog.Error("Unsupported file format", "file", path)
|
||||
os.Exit(1)
|
||||
}
|
||||
if err := sortSong(path, dst); err != nil {
|
||||
slog.Error("Failed to sort single file", "file", path, "err", err)
|
||||
os.Exit(1)
|
||||
@@ -50,6 +55,7 @@ func Sort(dst, path string) {
|
||||
return
|
||||
}
|
||||
|
||||
// Handle directory
|
||||
err = filepath.WalkDir(path, func(p string, d fs.DirEntry, err error) error {
|
||||
if err != nil {
|
||||
slog.Error("Failed to walk path", "path", path, "file", p, "err", err)
|
||||
@@ -57,6 +63,9 @@ func Sort(dst, path string) {
|
||||
}
|
||||
|
||||
if !d.IsDir() {
|
||||
if !fileSupported(p) {
|
||||
return nil
|
||||
}
|
||||
if err := sortSong(p, dst); err != nil {
|
||||
slog.Error("Failed to sort file", "file", p, "err", err)
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user