mirror of
https://github.com/mappu/miqt.git
synced 2025-02-08 22:10:23 +00:00
rcc: use a relative path in the go:embed line
This commit is contained in:
parent
0da95c13f8
commit
d8cb5494a0
@ -9,6 +9,7 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -41,12 +42,19 @@ func RccExec() error {
|
|||||||
*outputRcc = strings.TrimSuffix(*outputGo, `.go`) + `.rcc`
|
*outputRcc = strings.TrimSuffix(*outputGo, `.go`) + `.rcc`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The rcc output path must be relative to the output go file path
|
||||||
|
|
||||||
|
embedPath, err := filepath.Rel(filepath.Dir(*outputGo), *outputRcc)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
// Compile qrc to binary resource file
|
// Compile qrc to binary resource file
|
||||||
|
|
||||||
rccCmd := exec.Command(*rccBinary, `--binary`, `-o`, *outputRcc, *input)
|
rccCmd := exec.Command(*rccBinary, `--binary`, `-o`, *outputRcc, *input)
|
||||||
rccCmd.Stderr = os.Stderr
|
rccCmd.Stderr = os.Stderr
|
||||||
rccCmd.Stdout = os.Stdout
|
rccCmd.Stdout = os.Stdout
|
||||||
err := rccCmd.Run()
|
err = rccCmd.Run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -69,7 +77,7 @@ import (
|
|||||||
` + miqtImport + `
|
` + miqtImport + `
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed ` + *outputRcc + `
|
//go:embed ` + embedPath + `
|
||||||
var ` + *variableName + ` []byte
|
var ` + *variableName + ` []byte
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user