From ec7c7f1ecacc79abf6840e2f4f44257fa00a5e56 Mon Sep 17 00:00:00 2001 From: "craig.p.drummond" Date: Thu, 18 Sep 2014 16:29:35 +0000 Subject: [PATCH] Enable script to function under OSX. TODO: How to send message back to Cantata app under OSX?? --- dynamic/cantata-dynamic | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/dynamic/cantata-dynamic b/dynamic/cantata-dynamic index 624034797..d11c05251 100755 --- a/dynamic/cantata-dynamic +++ b/dynamic/cantata-dynamic @@ -198,6 +198,12 @@ sub getEntries() { } sub baseDir() { + if ($^O eq "darwin") { + # MacOSX + return "$ENV{'HOME'}/Library/Caches/cantata/cantata/dynamic"; + } + + # Linux my $cacheDir=$ENV{'XDG_CACHE_HOME'}; if (!$cacheDir) { $cacheDir="$ENV{'HOME'}/.cache"; @@ -543,10 +549,16 @@ sub sendMessage() { my $method=shift; my $argument=shift; if (0==$isServerMode) { - system("qdbus com.googlecode.cantata /cantata ${method} ${argument}"); - if ( $? == -1 ) { - # Maybe qdbus is not installed? Try dbus-send... - system("dbus-send --type=method_call --session --dest=com.googlecode.cantata /cantata com.googlecode.cantata.${method} string:${argument}"); + if ($^O eq "darwin") { + # MacOSX + # TODO: How to send a dbus (or other) message to Cantata application???? + } else { + # Linux + system("qdbus com.googlecode.cantata /cantata ${method} ${argument}"); + if ( $? == -1 ) { + # Maybe qdbus is not installed? Try dbus-send... + system("dbus-send --type=method_call --session --dest=com.googlecode.cantata /cantata com.googlecode.cantata.${method} string:${argument}"); + } } } else { my $clientId=shift;