Critical error upon missing submodules (#77)

* Critical error upon missing SPL

* Added checks for RakLib and PocketMine-Language

* It actually throws ClassNotFoundException, not simply returns false :(

Should I blame :shoghi:?
This commit is contained in:
SOFe
2016-11-06 11:46:39 +08:00
committed by GitHub
parent 1ac74fe5bc
commit 3b7377370c
2 changed files with 45 additions and 21 deletions

View File

@ -71,6 +71,7 @@ namespace pocketmine {
use pocketmine\utils\Terminal;
use pocketmine\utils\Utils;
use pocketmine\wizard\Installer;
use raklib\RakLib;
const VERSION = "1.6.1dev";
const API_VERSION = "2.1.0";
@ -104,6 +105,11 @@ namespace pocketmine {
}
if(!class_exists("ClassLoader", false)){
if(!is_file(\pocketmine\PATH . "src/spl/ClassLoader.php")){
echo "[CRITICAL] Unable to find the PocketMine-SPL library." . PHP_EOL;
echo "[CRITICAL] Please use provided builds or clone the repository recursively." . PHP_EOL;
exit(1);
}
require_once(\pocketmine\PATH . "src/spl/ClassLoader.php");
require_once(\pocketmine\PATH . "src/spl/BaseClassLoader.php");
require_once(\pocketmine\PATH . "src/pocketmine/CompatibleClassLoader.php");
@ -114,6 +120,14 @@ namespace pocketmine {
$autoloader->addPath(\pocketmine\PATH . "src" . DIRECTORY_SEPARATOR . "spl");
$autoloader->register(true);
try{
if(!class_exists(RakLib::class)){
throw new \Exception;
}
}catch(\Exception $e){
echo "[CRITICAL] Unable to find the RakLib library." . PHP_EOL;
exit(1);
}
set_time_limit(0); //Who set it to 30 seconds?!?!