1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
diff -uNrb airnef/airnefcmd.py airnef.new/airnefcmd.py
--- airnef/airnefcmd.py 2015-10-07 13:49:44.000000000 +0200
+++ airnef.new/airnefcmd.py 2021-04-17 18:38:09.950093592 +0200
@@ -134,6 +134,7 @@
self.isWin32 = None # True if we're running on a Windows platform
self.isOSX = None # True if we're runnong on an OSX platform
+ self.isLinux = None # True if we're runnong on an Linux platform
self.isFrozen = None # True if we're running in a pyintaller frozen environment (ie, built as an executable)
self.args = None # dictionary of command-line arguments (generated by argparse)
self.appDir = None # directory where script is located. this path is used to store all metadata files, in case script is run in different working directory
@@ -431,6 +432,7 @@
g.isWin32 = (platform.system() == 'Windows')
g.isOSX = (platform.system() == 'Darwin')
+ g.isLinux = (platform.system() == 'Linux')
g.isFrozen = (getattr(sys, 'frozen', False)) # note for OSX isFrozen is always false because py2app only marks airnef.pyw as frozen when we're a py2app
#
@@ -454,6 +456,10 @@
applicationSupportDir = os.path.join(userHomeDir, 'Library/Application Support')
if os.path.exists(applicationSupportDir): # probably not necessary to check existence since every system should have this directory
g.appDataDir = os.path.join(applicationSupportDir, 'airnef/appdata')
+ elif g.isLinux: # for OSX we always try to store our app data under Application Support
+ userHomeDir = os.getenv('HOME')
+ if userHomeDir:
+ g.appDataDir = os.path.join(userHomeDir, '.local/share/airnef')
if not g.appDataDir:
# none of runtime-specific cases above selected an app data directory - use directory based off our app directory
g.appDataDir = os.path.join(g.appDir, "appdata")
diff -uNrb airnef/airnef.pyw airnef.new/airnef.pyw
--- airnef/airnef.pyw 2015-10-08 09:57:00.000000000 +0200
+++ airnef.new/airnef.pyw 2021-04-17 18:41:38.719793894 +0200
@@ -45,15 +45,17 @@
from six.moves import tkinter_ttk as ttk
from six.moves import tkinter_tkfiledialog as tkFileDialog
from six.moves import tkinter_messagebox as tkMessageBox
-import time
-import subprocess
-import os
+
+import datetime
import errno
-import platform
import json
-import datetime
+import os
+import platform
+import re
import signal
+import subprocess
import sys
+import time
#
# constants
@@ -104,6 +106,7 @@
def __init__(self):
self.isWin32 = None # True if we're running on a Windows platform
self.isOSX = None # True if we're runnong on an OSX platform
+ self.isLinux = None # True if we're runnong on an Linux platform
self.isFrozen = None # True if we're running in a pyintaller frozen environment (ie, built as an executable)
self.appDir = None # directory where script is located. this path is used to store all metadata files, in case script is run in different working directory
self.appDataDir = None # directory where we keep app metadata
@@ -1202,6 +1205,7 @@
g.isWin32 = (platform.system() == 'Windows')
g.isOSX = (platform.system() == 'Darwin')
+ g.isLinux = (platform.system() == 'Linux')
g.isFrozen = (getattr(sys, 'frozen', False))
#
@@ -1226,6 +1230,10 @@
applicationSupportDir = os.path.join(userHomeDir, 'Library/Application Support')
if os.path.exists(applicationSupportDir): # probably not necessary to check existence since every system should have this directory
g.appDataDir = os.path.join(applicationSupportDir, 'airnef/appdata')
+ elif g.isLinux: # for Linux we use .local/share for that
+ userHomeDir = os.getenv('HOME')
+ if userHomeDir:
+ g.appDataDir = os.path.join(userHomeDir, '.local/share/airnef')
if not g.appDataDir:
# none of runtime-specific cases above selected an app data directory - use directory based off our app directory
g.appDataDir = os.path.join(g.appDir, "appdata")
|