summarylogtreecommitdiffstats
path: root/xdg_config_dirs.patch
blob: efeb12c9046e76d8e8112bd2ac8f489e9f0c8474 (plain)
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
--- src/var.py	2019-05-01 22:06:05.334383160 -0600
+++ src/var.py	2019-05-01 22:09:01.646756561 -0600
@@ -20,6 +20,19 @@
 GAM_LATEST_RELEASE = GAM_ALL_RELEASES+'/latest'
 GAM_PROJECT_APIS = 'https://raw.githubusercontent.com/jay0lee/GAM/master/src/project-apis.txt'
 
+try:
+  XDG_CONFIG_DIR = os.environ['XDG_CONFIG_HOME']
+except KeyError:
+  XDG_CONFIG_DIR = os.path.expanduser("~") + '/.config/'
+CONFIG_DIR = XDG_CONFIG_DIR + 'gam/'
+
+try:
+  os.makedirs(CONFIG_DIR, mode=700)
+except OSError:
+  if not os.path.isdir(CONFIG_DIR):
+    raise
+
+
 true_values = ['on', 'yes', 'enabled', 'true', '1']
 false_values = ['off', 'no', 'disabled', 'false', '0']
 usergroup_types = ['user', 'users',
@@ -32,8 +45,8 @@
 WARNING_PREFIX = 'WARNING: '
 UTF8 = 'utf-8'
 UTF8_SIG = 'utf-8-sig'
-FN_EXTRA_ARGS_TXT = 'extra-args.txt'
-FN_LAST_UPDATE_CHECK_TXT = 'lastupdatecheck.txt'
+FN_EXTRA_ARGS_TXT = CONFIG_DIR + 'extra-args.txt'
+FN_LAST_UPDATE_CHECK_TXT = CONFIG_DIR + 'lastupdatecheck.txt'
 MY_CUSTOMER = 'my_customer'
 # See https://support.google.com/drive/answer/37603
 MAX_GOOGLE_SHEET_CELLS = 5000000
@@ -640,9 +653,9 @@
 
 #
 _DEFAULT_CHARSET = UTF8
-_FN_CLIENT_SECRETS_JSON = 'client_secrets.json'
-_FN_OAUTH2SERVICE_JSON = 'oauth2service.json'
-_FN_OAUTH2_TXT = 'oauth2.txt'
+_FN_CLIENT_SECRETS_JSON = CONFIG_DIR + 'client_secrets.json'
+_FN_OAUTH2SERVICE_JSON = CONFIG_DIR + 'oauth2service.json'
+_FN_OAUTH2_TXT = CONFIG_DIR + 'oauth2.txt'
 #
 GM_Globals = {
   GM_SYSEXITRC: 0,
@@ -685,7 +698,7 @@
 # Path to client_secrets.json
 GC_CLIENT_SECRETS_JSON = 'client_secrets_json'
 # GAM config directory containing client_secrets.json, oauth2.txt, oauth2service.json, extra_args.txt
-GC_CONFIG_DIR = 'config_dir'
+GC_CONFIG_DIR = CONFIG_DIR
 # custmerId from gam.cfg or retrieved from Google
 GC_CUSTOMER_ID = 'customer_id'
 # If debug_level > 0: extra_args[u'prettyPrint'] = True, httplib2.debuglevel = gam_debug_level, appsObj.debug = True
@@ -752,7 +765,7 @@
   GC_MEMBER_MAX_RESULTS: 200,
   GC_NO_BROWSER: False,
   GC_NO_CACHE: False,
-  GC_NO_UPDATE_CHECK: False,
+  GC_NO_UPDATE_CHECK: True,
   GC_NUM_THREADS: 25,
   GC_OAUTH2_TXT: _FN_OAUTH2_TXT,
   GC_OAUTH2SERVICE_JSON: _FN_OAUTH2SERVICE_JSON,