2018-01-29 Richard Biener <rguenther@suse.de>
[official-gcc.git] / libgo / go / mime / type_windows.go
blob97b9aeba7a3dc8916fb41b391d1e4cbb5e8ebde7
1 // Copyright 2010 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 package mime
7 import (
8 "internal/syscall/windows/registry"
11 func init() {
12 osInitMime = initMimeWindows
15 func initMimeWindows() {
16 names, err := registry.CLASSES_ROOT.ReadSubKeyNames(-1)
17 if err != nil {
18 return
20 for _, name := range names {
21 if len(name) < 2 || name[0] != '.' { // looking for extensions only
22 continue
24 k, err := registry.OpenKey(registry.CLASSES_ROOT, name, registry.READ)
25 if err != nil {
26 continue
28 v, _, err := k.GetStringValue("Content Type")
29 k.Close()
30 if err != nil {
31 continue
33 setExtensionType(name, v)
37 func initMimeForTests() map[string]string {
38 return map[string]string{
39 ".PnG": "image/png",