+sub __function_vendor_directory {
+ my ($file, $name) = @_;
+
+ # Try to look the directory up in the environment...
+ my $key = __environment 'INSPIRCD_VENDOR_', $name;
+ if (defined $ENV{$key}) {
+ print_format "Found the <|GREEN $name|> vendor directory for <|GREEN ${\basename $file, '.cpp'}|> using the environment: <|BOLD $ENV{$key}|>\n";
+ return $ENV{$key};
+ }
+
+ my $directory = catdir(VENDOR_DIRECTORY, $name);
+ if (-d $directory) {
+ print_format "Using the default <|GREEN $name|> vendor directory for <|GREEN ${\basename $file, '.cpp'}|>: <|BOLD $directory|>\n";
+ return $directory;
+ }
+
+ # We can't find it via the environment or via the filesystem so give up.
+ __error $file, "unable to find the <|GREEN $name|> vendor directory for <|GREEN ${\basename $file, '.cpp'}|>!";
+}
+