summarylogtreecommitdiffstats
path: root/xdg_config_dirs.patch
blob: d1e2ef5a82b89d7d3681d3c3ae3d559ac28c3ae9 (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
--- src/var.py	2018-08-03 14:30:31.000000000 -0600
+++ src/var.py	2018-08-11 12:02:27.184546770 -0600
@@ -20,6 +20,18 @@
 GAM_LATEST_RELEASE = GAM_ALL_RELEASES+u'/latest'
 GAM_PROJECT_APIS = u'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 = unicode(XDG_CONFIG_DIR) + u'gam/'
+
+try:
+    os.makedirs(CONFIG_DIR, mode=0700)
+except OSError:
+    if not os.path.isdir(CONFIG_DIR):
+        raise
+
 TRUE = u'true'
 FALSE = u'false'
 true_values = [u'on', u'yes', u'enabled', u'true', u'1']
@@ -36,11 +48,11 @@
 ONE_KILO_BYTES = 1000
 ONE_MEGA_BYTES = 1000000
 ONE_GIGA_BYTES = 1000000000
-FN_CLIENT_SECRETS_JSON = u'client_secrets.json'
-FN_EXTRA_ARGS_TXT = u'extra-args.txt'
-FN_LAST_UPDATE_CHECK_TXT = u'lastupdatecheck.txt'
-FN_OAUTH2SERVICE_JSON = u'oauth2service.json'
-FN_OAUTH2_TXT = u'oauth2.txt'
+FN_CLIENT_SECRETS_JSON = CONFIG_DIR + u'client_secrets.json'
+FN_EXTRA_ARGS_TXT = CONFIG_DIR + u'extra-args.txt'
+FN_LAST_UPDATE_CHECK_TXT = CONFIG_DIR + u'lastupdatecheck.txt'
+FN_OAUTH2SERVICE_JSON = CONFIG_DIR + u'oauth2service.json'
+FN_OAUTH2_TXT = CONFIG_DIR + u'oauth2.txt'
 MY_CUSTOMER = u'my_customer'
 SKUS = {
   u'1010010001': {
@@ -653,7 +665,7 @@
 # Path to client_secrets.json
 GC_CLIENT_SECRETS_JSON = u'client_secrets_json'
 # GAM config directory containing client_secrets.json, oauth2.txt, oauth2service.json, extra_args.txt
-GC_CONFIG_DIR = u'config_dir'
+GC_CONFIG_DIR = CONFIG_DIR
 # custmerId from gam.cfg or retrieved from Google
 GC_CUSTOMER_ID = u'customer_id'
 # If debug_level > 0: extra_args[u'prettyPrint'] = True, httplib2.debuglevel = gam_debug_level, appsObj.debug = True
@@ -712,7 +724,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_NO_VERIFY_SSL: False,
   GC_NUM_THREADS: 25,
   GC_OAUTH2_TXT: FN_OAUTH2_TXT,