summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2011-10-30 01:24:05 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2011-10-30 01:24:05 +0100
commit76baa185773379170a2becbe506d22ce547ecc03 (patch)
treedc35dcf8ac4df6a1e8ae6104a8887a8b70c83e6e
parenta3e1b85048d3b66f8074f853b1935b080add79ee (diff)
downloadspotify-notify-76baa185773379170a2becbe506d22ce547ecc03.tar.bz2
Make the image cache actually use the HOME env var and make the cache if needed
-rw-r--r--spotify-notify.vala8
1 files changed, 6 insertions, 2 deletions
diff --git a/spotify-notify.vala b/spotify-notify.vala
index 1c97a5c..683bae9 100644
--- a/spotify-notify.vala
+++ b/spotify-notify.vala
@@ -41,8 +41,8 @@ Notify notify;
uint32 notification_id = 0;
Soup.SessionAsync soupsession;
-
-const string imgcache = "/home/dsilvers/.cache/spotify-albums";
+const string IMGCACHE_PATTERN="%s/.cache/spotify-albums";
+string imgcache;
void cancel_notification() {
try {
@@ -251,6 +251,10 @@ void on_media_player_key_pressed (string appname, string key) {
int main() {
MediaKeys mkeys;
BusInterface bi;
+
+ imgcache = IMGCACHE_PATTERN.printf(Environment.get_variable("HOME"));
+ DirUtils.create_with_parents(imgcache, 0700);
+
try {
soupsession = new Soup.SessionAsync ();
stdout.printf("Getting media keys\n");