summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkali <kali@leap.se>2018-10-10 19:08:55 -0400
committerKali Kaneko (leap communications) <kali@leap.se>2018-10-11 01:38:22 +0200
commit58f4ee7528d8ba0e5223a9ddf236739287b4ef4c (patch)
treebaa9586a0f85d3180549924dda8cd4b255518f27
parent34ed78a1f27a1cd3eb184b6b5304fafdb5b75022 (diff)
[feat] get version from file
if we're running from snap, we take the version string from a file in the snap folder. the version.sh script is executed during the creation of the snap, and is expected to write a version.txt file in the snap/ folder.
-rw-r--r--notificator.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/notificator.go b/notificator.go
index d57e931..07e1b26 100644
--- a/notificator.go
+++ b/notificator.go
@@ -16,6 +16,7 @@
package main
import (
+ "io/ioutil"
"os"
"path"
"runtime"
@@ -71,6 +72,12 @@ func (n *notificator) donations() {
}
func (n *notificator) about(version string) {
+ if version == "" && os.Getenv("SNAP") != "" {
+ _version, err := ioutil.ReadFile(os.Getenv("SNAP") + "/snap/version.txt")
+ if err == nil {
+ version = string(_version)
+ }
+ }
dialog.Message(printer.Sprintf(aboutText, applicationName, version)).
Title(printer.Sprintf("About")).
Icon(getIconPath()).