mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-26 13:59:47 +01:00
PBot: ensure data directory is not named data
This commit is contained in:
parent
e48ec432b8
commit
287e807a1d
10
PBot/PBot.pm
10
PBot/PBot.pm
@ -61,12 +61,14 @@ use PBot::Users;
|
|||||||
use PBot::Utils::ParseDate;
|
use PBot::Utils::ParseDate;
|
||||||
use PBot::WebPaste;
|
use PBot::WebPaste;
|
||||||
|
|
||||||
|
use Encode;
|
||||||
|
use File::Basename;
|
||||||
|
|
||||||
# set standard output streams to encode as utf8
|
# set standard output streams to encode as utf8
|
||||||
binmode(STDOUT, ":utf8");
|
binmode(STDOUT, ":utf8");
|
||||||
binmode(STDERR, ":utf8");
|
binmode(STDERR, ":utf8");
|
||||||
|
|
||||||
# decode command-line arguments from utf8
|
# decode command-line arguments from utf8
|
||||||
use Encode;
|
|
||||||
@ARGV = map { decode('UTF-8', $_, 1) } @ARGV;
|
@ARGV = map { decode('UTF-8', $_, 1) } @ARGV;
|
||||||
|
|
||||||
sub new {
|
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
|
# let modules register atexit subroutines
|
||||||
$self->{atexit} = PBot::Registerable->new(pbot => $self, %conf);
|
$self->{atexit} = PBot::Registerable->new(pbot => $self, %conf);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user