3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-22 20:09:43 +01:00

PBot: ensure data directory is not named data

This commit is contained in:
Pragmatic Software 2021-07-08 15:47:29 -07:00
parent e48ec432b8
commit 287e807a1d

View File

@ -61,12 +61,14 @@ use PBot::Users;
use PBot::Utils::ParseDate;
use PBot::WebPaste;
use Encode;
use File::Basename;
# set standard output streams to encode as utf8
binmode(STDOUT, ":utf8");
binmode(STDERR, ":utf8");
# decode command-line arguments from utf8
use Encode;
@ARGV = map { decode('UTF-8', $_, 1) } @ARGV;
sub new {
@ -121,6 +123,12 @@ sub initialize {
}
}
# insist that data directory be copied
if (basename($conf{data_dir}) eq 'data') {
print STDERR "Data directory ($conf{data_dir}) cannot be named `data`. This is to ensure the directory is copied from its default location. Please follow doc/QuickStart.md.\n";
exit;
}
# let modules register atexit subroutines
$self->{atexit} = PBot::Registerable->new(pbot => $self, %conf);