play.pl: fix bug for paths with /

This commit is contained in:
wowaname 2016-10-03 01:01:48 +00:00
parent 1158390ac5
commit 3e9e72d1f8

View File

@ -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 <FH>;
close FH;