You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
fw-daemon/fw-settings/settings/definitions/gen_file.go

24 lines
562 B

package definitions
import (
"encoding/hex"
"io/ioutil"
"path"
)
func fileContent() []byte {
decoded, _ := hex.DecodeString(schemaDefinition)
return decoded
}
func writeSchemaToDir(dir string) {
ioutil.WriteFile(path.Join(dir, "gschemas.compiled"), fileContent(), 0664)
}
// SchemaInTempDir will create a new temporary directory and put the gsettings schema file in there. It is the callers responsibility to remove the directory
func SchemaInTempDir() string {
dir, _ := ioutil.TempDir("", "fw-settings-gschema")
writeSchemaToDir(dir)
return dir
}