From 3e9e72d1f8db5c7fe365a9b1c8c389d95dc6bff4 Mon Sep 17 00:00:00 2001 From: wowaname Date: Mon, 3 Oct 2016 01:01:48 +0000 Subject: [PATCH] play.pl: fix bug for paths with / --- scripts/play.pl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/play.pl b/scripts/play.pl index ce42e7c..c440f8e 100644 --- a/scripts/play.pl +++ b/scripts/play.pl @@ -92,16 +92,19 @@ sub cmd_play { : weechat::config_integer($prio_s) ) or 10); - my $path = File::Find::Rule->file->name($file) + my $rule = File::Find::Rule->file->name($file) ->start(weechat::config_get_plugin('dir')); if ($find) { - weechat::print($buffer, " \t$_") while defined( $_ = $path->match ); + weechat::print($buffer, " \t$_") while defined( $_ = $rule->match ); return weechat::WEECHAT_RC_OK; } - if ($path = $path->match and open FH, "<", (($file !~ m"/") ? $path : - weechat::config_get_plugin('dir')."/$file")) { + my $path; + if ($file =~ m"/") { $path = weechat::config_get_plugin('dir')."/$file" } + else { $path = $rule->match } + + if ($path and open FH, "<", $path) { my @lines; push @lines, s/[\r\n]*$//r while ; close FH;