genqrc

command
v1.0.0-...-2ee7e5f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2015 License: LGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Command genqrc packs resource files into the Go binary.

Usage: genqrc [options] <subdir1> [<subdir2> ...]

The genqrc tool packs all resource files under the provided subdirectories into a single qrc.go file that may be built into the generated binary. Bundled files may then be loaded by Go or QML code under the URL "qrc:///some/path", where "some/path" matches the original path for the resource file locally.

For example, the following will load a .qml file from the resource pack, and that file may in turn reference other content (code, images, etc) in the pack:

component, err := engine.LoadFile("qrc://path/to/file.qml")

Starting with Go 1.4, this tool may be conveniently run by the "go generate" subcommand by adding a line similar to the following one to any existent .go file in the project (assuming the subdirectories ./code/ and ./images/ exist):

//go:generate genqrc code images

Then, just run "go generate" to update the qrc.go file.

During development, the generated qrc.go can repack the filesystem content at runtime to avoid the process of regenerating the qrc.go file and rebuilding the application to test every minor change made. Runtime repacking is enabled by setting the QRC_REPACK environment variable to 1:

export QRC_REPACK=1

This does not update the static content in the qrc.go file, though, so after the changes are performed, genqrc must be run again to update the content that will ship with built binaries.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL