93 lines
2.4 KiB
Go
93 lines
2.4 KiB
Go
package filetypes
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
tk "modernc.org/tk9.0"
|
|
)
|
|
|
|
type FileDescription struct {
|
|
TkTypeName string
|
|
MacExtensions []string
|
|
IconFile string
|
|
MIMETypes []string
|
|
TypeName string
|
|
OSTypes []string
|
|
ItemContentTypes string
|
|
}
|
|
|
|
var Valid = []FileDescription{
|
|
{
|
|
TkTypeName: "BMP",
|
|
MacExtensions: []string{"bmp", "BMP"},
|
|
IconFile: "bmp.icns",
|
|
MIMETypes: []string{"image/bmp"},
|
|
TypeName: "Windows Bitmap Image",
|
|
OSTypes: []string{"BMP ", "BMPf"},
|
|
ItemContentTypes: "com.microsoft.bmp",
|
|
},
|
|
{
|
|
TkTypeName: "JPEG",
|
|
MacExtensions: []string{"jpg", "JPG", "jpeg", "JPEG"},
|
|
IconFile: "jpeg.icns",
|
|
MIMETypes: []string{"image/jpeg"},
|
|
TypeName: "JPEG Image",
|
|
OSTypes: []string{"JPEG"},
|
|
ItemContentTypes: "public.jpeg",
|
|
},
|
|
{
|
|
TkTypeName: "GIF",
|
|
MacExtensions: []string{"gif", "GIF"},
|
|
IconFile: "gif.icns",
|
|
MIMETypes: []string{"image/gif"},
|
|
TypeName: "Graphics Interchange Format Image",
|
|
OSTypes: []string{"GIFf"},
|
|
ItemContentTypes: "com.compuserve.gif",
|
|
},
|
|
{
|
|
TkTypeName: "PNG",
|
|
MacExtensions: []string{"PNG", "png"},
|
|
IconFile: "png.icns",
|
|
MIMETypes: []string{"image/png"},
|
|
TypeName: "Portable Network Graphics Image",
|
|
OSTypes: []string{"PNGf"},
|
|
ItemContentTypes: "public.png",
|
|
},
|
|
{
|
|
TkTypeName: "TGA",
|
|
MacExtensions: []string{"tga", "TGA"},
|
|
IconFile: "tga.icns",
|
|
MIMETypes: []string{"image/targa", "image/tga", "application/tga"},
|
|
TypeName: "Targa Image",
|
|
OSTypes: []string{"TPIC"},
|
|
ItemContentTypes: "com.truevision.tga-image",
|
|
},
|
|
{
|
|
TkTypeName: "TIFF",
|
|
MacExtensions: []string{"tiff", "TIFF", "tif", "TIF"},
|
|
IconFile: "tiff.icns",
|
|
MIMETypes: []string{"image/tiff"},
|
|
TypeName: "TIFF Image",
|
|
OSTypes: []string{"TIFF"},
|
|
ItemContentTypes: "public.tiff",
|
|
},
|
|
}
|
|
|
|
func GetTkTypes(fds []FileDescription) []tk.FileType {
|
|
fts := make([]tk.FileType, len(fds))
|
|
for i, fd := range fds {
|
|
fts[i] = tk.FileType{
|
|
TypeName: fd.TkTypeName,
|
|
Extensions: make([]string, len(fd.MacExtensions)),
|
|
}
|
|
for j, ex := range fd.MacExtensions {
|
|
fts[i].Extensions[j] = fmt.Sprintf(".%s", ex)
|
|
}
|
|
}
|
|
return fts
|
|
}
|
|
|
|
func main() {
|
|
fmt.Println("test")
|
|
}
|