From 0ba109b594efc5a18e9072aa8cd467012bcab988 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Sun, 20 Sep 2020 20:15:59 -0700 Subject: [PATCH] pbot: improve reliability of finding bothome --- pbot | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/pbot b/pbot index a73a67b1..5e8df3ff 100755 --- a/pbot +++ b/pbot @@ -4,21 +4,16 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -# bothome is automatically set by this script, do not modify -my $bothome; -BEGIN { - use File::Basename; - $bothome = -l __FILE__ ? dirname readlink __FILE__ : dirname __FILE__; - unshift @INC, $bothome; -} +use FindBin qw($RealBin); +use lib "$RealBin/."; # configuration is overridden via command-line arguments, do not modify # see doc/QuickStart.md my %config = ( - data_dir => "$bothome/data", - module_dir => "$bothome/modules", - plugin_dir => "$bothome/Plugins", - update_dir => "$bothome/updates", + data_dir => "$RealBin/data", + module_dir => "$RealBin/modules", + plugin_dir => "$RealBin/Plugins", + update_dir => "$RealBin/updates", ); use PBot::PBot;