Adding the copy of icon files within the package

This commit is contained in:
Resousse 2023-08-29 15:34:14 +02:00
parent 9a615b4f08
commit 21a9d7445d
2 changed files with 12 additions and 2 deletions

View File

@ -6,10 +6,11 @@ COVER_HTML=cover.html
all: open all: open
build: clean build: clean
mkdir -p -v ./bin/amm.app/Contents/Resources mkdir -p -v ./bin/amm.app/Contents/Resources/assets/icon
mkdir -p -v ./bin/amm.app/Contents/MacOS mkdir -p -v ./bin/amm.app/Contents/MacOS
cp ./appInfo/*.plist ./bin/amm.app/Contents/Info.plist cp ./appInfo/*.plist ./bin/amm.app/Contents/Info.plist
cp ./appInfo/*.icns ./bin/amm.app/Contents/Resources/icon.icns cp ./appInfo/*.icns ./bin/amm.app/Contents/Resources/icon.icns
cp ./assets/icon/* ./bin/amm.app/Contents/Resources/assets/icon
go build -o ./bin/amm.app/Contents/MacOS/amm cmd/main.go go build -o ./bin/amm.app/Contents/MacOS/amm cmd/main.go
open: build open: build

View File

@ -31,7 +31,16 @@ func getIcon(iconName string, active bool) []byte {
if iconName != "mouse" && iconName != "cloud" && iconName != "geometric" && iconName != "man" { if iconName != "mouse" && iconName != "cloud" && iconName != "geometric" && iconName != "man" {
iconName = "mouse" iconName = "mouse"
} }
b, err := os.ReadFile("../assets/icon/" + iconName + ".png") var b []byte
var err error
ex, _ := os.Executable()
exPath := filepath.Dir(ex)
if _, err := os.Stat(exPath + "/../Resources/assets/icon"); os.IsNotExist(err) {
b, err = os.ReadFile(exPath + "/../assets/icon/" + iconName + ".png")
} else {
b, err = os.ReadFile(exPath + "/../Resources/assets/icon/" + iconName + ".png")
}
if err != nil { if err != nil {
panic(err) panic(err)
} }