aboutsummaryrefslogtreecommitdiff
path: root/ponysay
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2012-08-20 18:53:00 +0200
committerMattias Andrée <maandree@operamail.com>2012-08-20 18:53:00 +0200
commit908616bcea3acaa34ad6b10b28e489189bb689db (patch)
treee53166a9e2c1fea9f16a25036dd096d6578f7151 /ponysay
parent22963aebbc071fb26a3a4c8e492d99c4289ac5d9 (diff)
downloadponysay-908616bcea3acaa34ad6b10b28e489189bb689db.tar.gz
ponysay-908616bcea3acaa34ad6b10b28e489189bb689db.tar.bz2
ponysay-908616bcea3acaa34ad6b10b28e489189bb689db.zip
private cache
Diffstat (limited to 'ponysay')
-rwxr-xr-xponysay10
1 files changed, 8 insertions, 2 deletions
diff --git a/ponysay b/ponysay
index 8cbada9..9786f66 100755
--- a/ponysay
+++ b/ponysay
@@ -452,11 +452,17 @@ class Ponysay():
palette = env_kms
palettefile = env_kms.replace('\033]P', '')
- kmsponies = '/var/cache/ponysay/kmsponies/' + palettefile
+ cachedir = '/var/cache/ponysay'
+ if not os.path.isdir(cachedir):
+ cachedir = HOME + '/.cache/ponysay'
+ if not os.path.isdir(cachedir):
+ os.makedirs(cachedir)
+
+ kmsponies = cachedir + '/kmsponies/' + palettefile
kmspony = (kmsponies + pony).replace('//', '/')
if not os.path.isfile(kmspony):
- protokmsponies = '/var/cache/ponysay/protokmsponies/'
+ protokmsponies = cachedir + '/protokmsponies/'
protokmspony = (protokmsponies + pony).replace('//', '/')
protokmsponydir = protokmspony[:protokmspony.rindex('/')]