Source file
src/mime/type_windows.go
1
2
3
4
5 package mime
6
7 import (
8 "internal/syscall/windows/registry"
9 )
10
11 func init() {
12 osInitMime = initMimeWindows
13 }
14
15 func initMimeWindows() {
16 names, err := registry.CLASSES_ROOT.ReadSubKeyNames()
17 if err != nil {
18 return
19 }
20 for _, name := range names {
21 if len(name) < 2 || name[0] != '.' {
22 continue
23 }
24 k, err := registry.OpenKey(registry.CLASSES_ROOT, name, registry.READ)
25 if err != nil {
26 continue
27 }
28 v, _, err := k.GetStringValue("Content Type")
29 k.Close()
30 if err != nil {
31 continue
32 }
33 setExtensionType(name, v)
34 }
35 }
36
37 func initMimeForTests() map[string]string {
38 return map[string]string{
39 ".PnG": "image/png",
40 }
41 }
42
View as plain text