From d8cb5494a0eb6f4729c549dc798065b3ed5deddd Mon Sep 17 00:00:00 2001 From: mappu Date: Thu, 6 Feb 2025 19:18:03 +1300 Subject: [PATCH] rcc: use a relative path in the go:embed line --- cmd/miqt-rcc/main.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cmd/miqt-rcc/main.go b/cmd/miqt-rcc/main.go index 5d8b972d..b2c48fe3 100644 --- a/cmd/miqt-rcc/main.go +++ b/cmd/miqt-rcc/main.go @@ -9,6 +9,7 @@ import ( "io/ioutil" "os" "os/exec" + "path/filepath" "strings" ) @@ -41,12 +42,19 @@ func RccExec() error { *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 rccCmd := exec.Command(*rccBinary, `--binary`, `-o`, *outputRcc, *input) rccCmd.Stderr = os.Stderr rccCmd.Stdout = os.Stdout - err := rccCmd.Run() + err = rccCmd.Run() if err != nil { return err } @@ -69,7 +77,7 @@ import ( ` + miqtImport + ` ) -//go:embed ` + *outputRcc + ` +//go:embed ` + embedPath + ` var ` + *variableName + ` []byte func init() {