From 58f4ee7528d8ba0e5223a9ddf236739287b4ef4c Mon Sep 17 00:00:00 2001
From: kali <kali@leap.se>
Date: Wed, 10 Oct 2018 19:08:55 -0400
Subject: [PATCH] [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.
---
 notificator.go | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/notificator.go b/notificator.go
index d57e9314..07e1b261 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()).
-- 
GitLab