From 908616bcea3acaa34ad6b10b28e489189bb689db Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 20 Aug 2012 18:53:00 +0200 Subject: private cache --- ponysay | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'ponysay') 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('/')] -- cgit