54 lines
1.0 KiB
Go
54 lines
1.0 KiB
Go
package main
|
|
|
|
// This file is automatically generated by github.com/limetext/qml-go/cmd/genqrc
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"os"
|
|
"path/filepath"
|
|
|
|
"github.com/limetext/qml-go"
|
|
)
|
|
|
|
func init() {
|
|
var r *qml.Resources
|
|
var err error
|
|
err = qrcRepackResources()
|
|
if err != nil {
|
|
panic("cannot repack qrc resources: " + err.Error())
|
|
}
|
|
r, err = qml.ParseResources(qrcResourcesRepacked)
|
|
if err != nil {
|
|
panic("cannot parse bundled resources data: " + err.Error())
|
|
}
|
|
qml.LoadResources(r)
|
|
}
|
|
|
|
func qrcRepackResources() error {
|
|
subdirs := []string{"qml"}
|
|
var rp qml.ResourcesPacker
|
|
for _, subdir := range subdirs {
|
|
err := filepath.Walk(subdir, func(path string, info os.FileInfo, err error) error {
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if info.IsDir() {
|
|
return nil
|
|
}
|
|
data, err := ioutil.ReadFile(path)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
rp.Add(filepath.ToSlash(path), data)
|
|
return nil
|
|
})
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
qrcResourcesRepacked = rp.Pack().Bytes()
|
|
return nil
|
|
}
|
|
|
|
var qrcResourcesRepacked []byte
|