mirror of
https://github.com/prashantgupta24/automatic-mouse-mover.git
synced 2024-12-23 08:54:10 +00:00
Adding the copy of icon files within the package
This commit is contained in:
parent
9a615b4f08
commit
21a9d7445d
3
Makefile
3
Makefile
@ -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
|
||||||
|
11
cmd/main.go
11
cmd/main.go
@ -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)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user