forked from jayallen/melody
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Melody::Test::Util to git repo. Was left out from an earlier co…
…mmit from what I can tell.
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package Melody::Util::Test; | ||
use strict; | ||
use warnings; | ||
|
||
use File::Spec; | ||
|
||
sub find_addon_libs { | ||
my $addons_full_path = shift; | ||
my @libs; | ||
opendir ADDONS, $addons_full_path; | ||
my @addons = readdir ADDONS; | ||
closedir ADDONS; | ||
for (@addons) { | ||
my $plugin_full_path = File::Spec->catdir($addons_full_path, $_); | ||
next unless -d $plugin_full_path; | ||
next if $_ eq '..'; | ||
opendir SUBDIR, $plugin_full_path; | ||
my @plugin_files = readdir SUBDIR; | ||
closedir SUBDIR; | ||
for my $file (@plugin_files) { | ||
if ($file eq 'lib' || $file eq 'extlib') { | ||
my $plib = File::Spec->catdir($plugin_full_path, $file); | ||
unshift @libs, $plib if -d $plib; | ||
} | ||
} | ||
} | ||
return \@libs; | ||
} | ||
|
||
1; |