generate plist from filetypes and inject into app bundle
This commit is contained in:
86
filetypes/filetypes.go
Normal file
86
filetypes/filetypes.go
Normal file
@@ -0,0 +1,86 @@
|
||||
package filetypes
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
tk "modernc.org/tk9.0"
|
||||
)
|
||||
|
||||
type FileDescription struct {
|
||||
TkType tk.FileType
|
||||
MacExtensions []string
|
||||
IconFile string
|
||||
MIMETypes []string
|
||||
TypeName string
|
||||
OSTypes []string
|
||||
ItemContentTypes string
|
||||
}
|
||||
|
||||
var Valid = []FileDescription{
|
||||
{
|
||||
TkType: tk.FileType{TypeName: "BMP", Extensions: []string{".bmp"}},
|
||||
MacExtensions: []string{"bmp", "BMP"},
|
||||
IconFile: "bmp.icns",
|
||||
MIMETypes: []string{"image/bmp"},
|
||||
TypeName: "Windows Bitmap Image",
|
||||
OSTypes: []string{"BMP ", "BMPf"},
|
||||
ItemContentTypes: "com.microsoft.bmp",
|
||||
},
|
||||
{
|
||||
TkType: tk.FileType{TypeName: "JPEG", Extensions: []string{".jpg", ".jpeg"}},
|
||||
MacExtensions: []string{"jpg", "JPG", "jpeg", "JPEG"},
|
||||
IconFile: "jpeg.icns",
|
||||
MIMETypes: []string{"image/jpeg"},
|
||||
TypeName: "JPEG Image",
|
||||
OSTypes: []string{"JPEG"},
|
||||
ItemContentTypes: "public.jpeg",
|
||||
},
|
||||
{
|
||||
TkType: tk.FileType{TypeName: "GIF", Extensions: []string{".gif"}},
|
||||
MacExtensions: []string{"gif", "GIF"},
|
||||
IconFile: "gif.icns",
|
||||
MIMETypes: []string{"image/gif"},
|
||||
TypeName: "Graphics Interchange Format Image",
|
||||
OSTypes: []string{"GIFf"},
|
||||
ItemContentTypes: "com.compuserve.gif",
|
||||
},
|
||||
{
|
||||
TkType: tk.FileType{TypeName: "PNG", Extensions: []string{".png"}},
|
||||
MacExtensions: []string{"PNG", "png"},
|
||||
IconFile: "png.icns",
|
||||
MIMETypes: []string{"image/png"},
|
||||
TypeName: "Portable Network Graphics Image",
|
||||
OSTypes: []string{"PNGf"},
|
||||
ItemContentTypes: "public.png",
|
||||
},
|
||||
{
|
||||
TkType: tk.FileType{TypeName: "TGA", Extensions: []string{".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",
|
||||
},
|
||||
{
|
||||
TkType: tk.FileType{TypeName: "TIFF", Extensions: []string{".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] = fd.TkType
|
||||
}
|
||||
return fts
|
||||
}
|
||||
|
||||
func main() {
|
||||
fmt.Println("test")
|
||||
}
|
Reference in New Issue
Block a user