rcc: infer embed data rcc filename from go file instead of qrc file

This commit is contained in:
mappu 2025-02-06 19:16:56 +13:00
parent 78c1178a62
commit adc3f08d4d

View File

@ -17,8 +17,8 @@ func main() {
// Parse arguments // Parse arguments
input := flag.String("Input", "", "Path to .qrc input file") input := flag.String("Input", "", "Path to .qrc input file")
outputRcc := flag.String("OutputRcc", "", "(Optional) Path to .rcc output file. If omitted, inferred from the input file path")
outputGo := flag.String("OutputGo", "", "(Optional) Path to .go output file. If omitted, interred from the input file path") outputGo := flag.String("OutputGo", "", "(Optional) Path to .go output file. If omitted, interred from the input file path")
outputRcc := flag.String("OutputRcc", "", "(Optional) Path to .rcc output file. If omitted, inferred from the output Go file path")
packageName := flag.String("Package", "main", "Package to use in generated Go files") packageName := flag.String("Package", "main", "Package to use in generated Go files")
variableName := flag.String("VariableName", "_resourceRcc", "Temporary global variable name for loading embedded data") variableName := flag.String("VariableName", "_resourceRcc", "Temporary global variable name for loading embedded data")
useQt6 := flag.Bool("Qt6", false, "Use Qt 6 instead of Qt 5") useQt6 := flag.Bool("Qt6", false, "Use Qt 6 instead of Qt 5")
@ -33,12 +33,13 @@ func main() {
// Fill in default output names, if not specified // Fill in default output names, if not specified
if *outputRcc == "" {
*outputRcc = strings.TrimSuffix(*input, `.qrc`) + `.rcc`
}
if *outputGo == "" { if *outputGo == "" {
*outputGo = strings.TrimSuffix(*input, `.qrc`) + `.go` *outputGo = strings.TrimSuffix(*input, `.qrc`) + `.go`
} }
if *outputRcc == "" {
// Base this on the outputGo filename, not the input filename
*outputRcc = strings.TrimSuffix(*outputGo, `.go`) + `.rcc`
}
// Compile qrc to binary resource file // Compile qrc to binary resource file