Skip to content

Commit

Permalink
Added user-local config dir on desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
markqvist committed Jul 8, 2022
1 parent ad4662e commit 06642c0
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
5 changes: 4 additions & 1 deletion sbapp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ apk: prepare release postbuild

devapk: prepare debug postbuild

version:
@(echo $$(python ./gv.py))

install:
adb install bin/sideband-0.1.7-arm64-v8a-release.apk
adb install bin/sideband-$$(python ./gv.py)-arm64-v8a-release.apk

console:
(adb logcat | grep python)
Expand Down
17 changes: 17 additions & 0 deletions sbapp/gv.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import re
import os
def gv() -> str:
version_file = os.path.join(
os.path.dirname(__file__), "main.py"
)

version_file_data = open(version_file, "rt", encoding="utf-8").read()
version_regex = r"(?<=^__version__ = ['\"])[^'\"]+(?=['\"]$)"
try:
version = re.findall(version_regex, version_file_data, re.M)[0]
return version
except IndexError:
raise ValueError(f"Unable to find version string in {version_file}.")

print(gv(), end="")
exit(0)
5 changes: 2 additions & 3 deletions sbapp/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
import time

from kivy.logger import Logger, LOG_LEVELS
# TODO: Reset
# Logger.setLevel(LOG_LEVELS["error"])
Logger.setLevel(LOG_LEVELS["error"])

from kivymd.app import MDApp
from kivy.core.window import Window
Expand Down Expand Up @@ -34,7 +33,7 @@
from kivymd.uix.button import MDFlatButton
from kivymd.uix.dialog import MDDialog

__version__ = "0.1.7"
__version__ = "0.1.8"
__variant__ = "beta"

if RNS.vendor.platformutils.get_platform() == "android":
Expand Down
4 changes: 2 additions & 2 deletions sbapp/sideband/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ def __init__(self, owner_app):
self.owner_app = owner_app
self.reticulum = None

self.app_dir = plyer.storagepath.get_application_dir()
self.app_dir = plyer.storagepath.get_home_dir()+"/.sideband"

self.rns_configdir = None
if RNS.vendor.platformutils.get_platform() == "android":
self.app_dir = self.app_dir+"/io.unsigned.sideband/files/"
self.app_dir = plyer.storagepath.get_application_dir()+"/io.unsigned.sideband/files/"
self.rns_configdir = self.app_dir+"/app_storage/reticulum"

if not os.path.isdir(self.app_dir+"/app_storage"):
Expand Down

0 comments on commit 06642c0

Please sign in to comment.