diff --git a/scripts/play.pl b/scripts/play.pl index e283709..2705a92 100644 --- a/scripts/play.pl +++ b/scripts/play.pl @@ -96,7 +96,7 @@ sub cmd_play { return weechat::WEECHAT_RC_OK; } - if ($path and open FH, "<", (($file !~ m"/") ? $path->match : + if ($path = $path->match and open FH, "<", (($file !~ m"/") ? $path : weechat::config_get_plugin('dir')."/$file")) { while () { s/[\r\n]*$//; @@ -110,7 +110,7 @@ sub cmd_play { 'play', $buffer); } else { weechat::print($buffer, weechat::prefix('error'). - "Cannot open '$file': $!"); + "Cannot open '$file'".($! ? ": $!" : "")); return weechat::WEECHAT_RC_ERROR; }