Workaround for glob() fail, fix worlds not loading properly on some systems, close #197

This commit is contained in:
Dylan K. Taylor 2016-12-23 12:53:00 +00:00
parent 3672d60bf4
commit 1eaf7c5431

View File

@ -210,6 +210,12 @@ class McRegion extends BaseLevelProvider{
if($isValid){
$files = glob($path . "/region/*.mc*");
if(empty($files)){ //possible glob() issue on some systems
$files = array_filter(scandir($path . "/region/"), function($file){
return substr($file, strrpos($file, ".") + 1, 2) === "mc"; //region file
});
}
foreach($files as $f){
if(substr($f, strrpos($f, ".") + 1) !== static::REGION_FILE_EXTENSION){
$isValid = false;