linux build can now access assets in various */share/cwtch/assets folders. linux installer installs multiple sized icons
the build was successful Papildu informācija

This commit is contained in:
Dan Ballard 2020-12-11 18:53:23 -08:00
vecāks 4cdb507e5e
revīzija 4bb5a52b9f
9 mainīti faili ar 34 papildinājumiem un 5 dzēšanām

Parādīt failu

@ -2,7 +2,7 @@
Name=Cwtch
Comment=Metadata Resistant Instant Messaging
Exec=~/.local/bin/cwtch
Icon=~/.local/share/icons/cwtch.png
Icon=cwtch
StartupNotify=true
Type=Application
Keywords=Internet;IM;Instant Messaging;Messaging;Chat

Binārs
linux/cwtch.png

Bināro failu nav iespējams attēlot.

Pirms

Platums:  |  Augstums:  |  Izmērs: 3.9 KiB

Bināro failu nav iespējams attēlot.

Pēc

Platums:  |  Augstums:  |  Izmērs: 9.4 KiB

Bināro failu nav iespējams attēlot.

Pēc

Platums:  |  Augstums:  |  Izmērs: 798 B

Bināro failu nav iespējams attēlot.

Pēc

Platums:  |  Augstums:  |  Izmērs: 1.9 KiB

Bināro failu nav iespējams attēlot.

Pēc

Platums:  |  Augstums:  |  Izmērs: 2.9 KiB

Bināro failu nav iespējams attēlot.

Pēc

Platums:  |  Augstums:  |  Izmērs: 4.0 KiB

Parādīt failu

@ -6,5 +6,10 @@ cp ui ~/.local/bin/cwtch
mkdir -p ~/.local/share/icons
cp cwtch.png ~/.local/share/icons
mkdir -p ~/.local/share/cwtch
cp -r assets ~/.local/share/cwtch
cp -r icons ~/.local/share/
mkdir -p ~/.local/share/applications
sed "s|~|$HOME|" cwtch.desktop > $HOME/.local/share/applications/cwtch.desktop

32
main.go
Parādīt failu

@ -181,14 +181,38 @@ func mainUi(flagLocal bool, flagClientUI bool) {
log.Infof("core.QCoreApplication_ApplicationDirPath(): %v\n", dir)
if runtime.GOOS == "android" {
gcd.SetAssetPath("assets:/")
} else {
} else if runtime.GOOS == "windows" {
// all of these access are QML based, and QML takes URIs which use forward slashes and translates them to local OS sperators
// also windows paths need to be like /c:/PATH
if runtime.GOOS == "windows" {
dir = "/" + dir
}
dir = "/" + dir
// QML uses '/' regardless of platform (so we use path.Join here not filepath.Join)
gcd.SetAssetPath("file://" + path.Join(dir, "assets") + "/")
} else {
if buildVer == "" || flagLocal {
if _, err := os.Stat(path.Join(dir, "assets")); !os.IsNotExist(err) {
gcd.SetAssetPath("file://" + path.Join(dir, "assets") + "/")
}
} else {
usr, err := user.Current()
if err != nil {
log.Errorf("\nerror: could not load current user: %v\n", err)
os.Exit(1)
}
localCwtch := path.Join(usr.HomeDir, ".local/share/cwtch")
if _, err := os.Stat(localCwtch); !os.IsNotExist(err) {
gcd.SetAssetPath("file://" + path.Join(localCwtch, "assets") + "/")
} else if _, err := os.Stat("/usr/share/cwtch"); !os.IsNotExist(err) {
gcd.SetAssetPath("file://" + "/usr/share/cwtch/assets/")
} else if _, err := os.Stat("/usr/local/share/cwtch/"); !os.IsNotExist(err) {
gcd.SetAssetPath("file://" + "/usr/local/share/cwtch/assets/")
} else if _, err := os.Stat(path.Join(dir, "assets")); !os.IsNotExist(err) {
gcd.SetAssetPath("file://" + path.Join(dir, "assets") + "/")
}
}
if gcd.AssetPath() == "" {
log.Errorf("Could not find assets folder")
os.Exit(-1)
}
}
log.Infof("gcd.assetPath = '%v'\n", gcd.AssetPath())