Browse Source

linux build can now access assets in various */share/cwtch/assets folders. linux installer installs multiple sized icons

pull/456/head
Dan Ballard 1 month ago
parent
commit
4bb5a52b9f
9 changed files with 34 additions and 5 deletions
  1. +1
    -1
      linux/cwtch.desktop
  2. BIN
      linux/cwtch.png
  3. BIN
      linux/icons/hicolor/128x128/apps/cwtch.png
  4. BIN
      linux/icons/hicolor/16x16/apps/cwtch.png
  5. BIN
      linux/icons/hicolor/32x32/apps/cwtch.png
  6. BIN
      linux/icons/hicolor/48x48/apps/cwtch.png
  7. BIN
      linux/icons/hicolor/64x64/apps/cwtch.png
  8. +5
    -0
      linux/install.sh
  9. +28
    -4
      main.go

+ 1
- 1
linux/cwtch.desktop View File

@@ -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
linux/cwtch.png View File

Before After
Width: 64  |  Height: 64  |  Size: 3.9 KiB

BIN
linux/icons/hicolor/128x128/apps/cwtch.png View File

Before After
Width: 128  |  Height: 128  |  Size: 9.4 KiB

BIN
linux/icons/hicolor/16x16/apps/cwtch.png View File

Before After
Width: 16  |  Height: 16  |  Size: 798 B

BIN
linux/icons/hicolor/32x32/apps/cwtch.png View File

Before After
Width: 32  |  Height: 32  |  Size: 1.9 KiB

BIN
linux/icons/hicolor/48x48/apps/cwtch.png View File

Before After
Width: 48  |  Height: 48  |  Size: 2.9 KiB

BIN
linux/icons/hicolor/64x64/apps/cwtch.png View File

Before After
Width: 64  |  Height: 64  |  Size: 4.0 KiB

+ 5
- 0
linux/install.sh View File

@@ -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

+ 28
- 4
main.go View File

@@ -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())



Loading…
Cancel
Save