more refactoring
This commit is contained in:
@@ -2,6 +2,10 @@ package filetypes
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
tk "modernc.org/tk9.0"
|
||||
)
|
||||
@@ -95,3 +99,19 @@ func GetTkTypes(fds []FileDescription) []tk.FileType {
|
||||
}
|
||||
return fts
|
||||
}
|
||||
|
||||
func IsImage(entry os.DirEntry) bool {
|
||||
if entry.IsDir() {
|
||||
return false
|
||||
}
|
||||
ext := filepath.Ext(entry.Name())
|
||||
if ext == "" {
|
||||
return false
|
||||
}
|
||||
for _, ft := range Valid {
|
||||
if slices.Contains(ft.MacExtensions, strings.ToLower(ext[1:])) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
Reference in New Issue
Block a user