diff --git a/Makefile b/Makefile
index c2b5a1fd9d..565d304460 100644
--- a/Makefile
+++ b/Makefile
@@ -155,6 +155,7 @@ ifeq ($(RELEASE),false)
# Enable debugging symbols in DOtherSide, in case we need GDB backtraces
CFLAGS += -g
CXXFLAGS += -g
+ RCC_PARAMS = --no-compress
else
# Additional optimization flags for release builds are not included at present;
# adding them will involve refactoring config.nims in the root of this repo
@@ -209,8 +210,8 @@ rcc:
echo -e $(BUILD_MSG) "resources.rcc"
rm -f ./resources.rcc
rm -f ./ui/resources.qrc
- ./ui/generate-rcc.sh
- rcc -binary ui/resources.qrc -o ./resources.rcc
+ go run ui/generate-rcc.go -source=ui -output=ui/resources.qrc
+ rcc -binary $(RCC_PARAMS) ui/resources.qrc -o ./resources.rcc
# default token is a free-tier token with limited capabilities and usage
# limits; our docs should include directions for community contributor to setup
diff --git a/ui/generate-rcc.go b/ui/generate-rcc.go
new file mode 100644
index 0000000000..a9902422d5
--- /dev/null
+++ b/ui/generate-rcc.go
@@ -0,0 +1,69 @@
+package main
+
+import (
+ "flag"
+ "fmt"
+ "log"
+ "os"
+ "path/filepath"
+ "strings"
+)
+
+var qrcExtensions = map[string]bool{
+ ".qml": true,
+ ".js": true,
+ ".svg": true,
+ ".png": true,
+ ".ico": true,
+ ".icns": true,
+ ".mp3": true,
+ ".wav": true,
+ ".otf": true,
+ ".ttf": true,
+ ".webm": true,
+ ".qm": true,
+}
+
+func main() {
+ sourceDirName := flag.String("source", "", "source dir containing ui files")
+ qrcFileName := flag.String("output", "resources.qrc", "output filename")
+ flag.Parse()
+ if flag.NFlag() == 0 {
+ flag.Usage()
+ return
+ }
+
+ qrcFile, err := os.Create(*qrcFileName)
+ if err != nil {
+ log.Fatalf("Failed creating qrc file: %s", err)
+ }
+ defer qrcFile.Close()
+
+ qrcFile.WriteString("\n")
+ qrcFile.WriteString("\n")
+ qrcFile.WriteString(" \n")
+
+ counter := 0
+ err = filepath.Walk(*sourceDirName,
+ func(path string, info os.FileInfo, err error) error {
+ if err != nil {
+ return err
+ }
+ if !info.IsDir() {
+ ext := filepath.Ext(path)
+ base := filepath.Base(path)
+ if qrcExtensions[ext] || base == "qmldir" {
+ counter++
+ fixedPath := strings.ReplaceAll(path, "\\", "/")
+ fixedPath = "./" + strings.TrimPrefix(fixedPath, *sourceDirName)
+ qrcFile.WriteString(" " + fixedPath + "\n")
+ }
+ }
+ return nil
+ })
+
+ qrcFile.WriteString(" \n")
+ qrcFile.WriteString("")
+
+ fmt.Printf("%d resources added\n", counter)
+}
diff --git a/ui/generate-rcc.sh b/ui/generate-rcc.sh
deleted file mode 100755
index 4791ab4ba9..0000000000
--- a/ui/generate-rcc.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-cd ./ui/
-QRC=./resources.qrc
-echo '' > $QRC
-echo '' >> $QRC
-echo ' ' >> $QRC
-for a in $(find -L . -not -name "*.pro" -not -name "*.rcc" -not -name "*.sh" -not -name "*.qrc" -not -name ".git" -not -name ".gitignore" )
-do
- if [ ! -d "$a" ]; then
- echo ' '$a'' >> $QRC
- fi
-done
-echo ' ' >> $QRC
-echo '' >> $QRC
-cd ..
\ No newline at end of file