mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-11 08:19:45 +00:00
DiskResourceProvider: do not arbitrarily suffix /resources/
This commit is contained in:
parent
81620441a4
commit
bcc3e20c31
@ -55,8 +55,8 @@ class DiskResourceProvider implements ResourceProvider{
|
|||||||
*/
|
*/
|
||||||
public function getResource(string $filename){
|
public function getResource(string $filename){
|
||||||
$filename = rtrim(str_replace("\\", "/", $filename), "/");
|
$filename = rtrim(str_replace("\\", "/", $filename), "/");
|
||||||
if(file_exists($this->file . "/resources/" . $filename)){
|
if(file_exists($this->file . "/" . $filename)){
|
||||||
return fopen($this->file . "/resources/" . $filename, "rb");
|
return fopen($this->file . "/" . $filename, "rb");
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -69,10 +69,10 @@ class DiskResourceProvider implements ResourceProvider{
|
|||||||
*/
|
*/
|
||||||
public function getResources() : array{
|
public function getResources() : array{
|
||||||
$resources = [];
|
$resources = [];
|
||||||
if(is_dir($this->file . "resources/")){
|
if(is_dir($this->file)){
|
||||||
foreach(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->file . "resources/")) as $resource){
|
foreach(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->file)) as $resource){
|
||||||
if($resource->isFile()){
|
if($resource->isFile()){
|
||||||
$path = str_replace(DIRECTORY_SEPARATOR, "/", substr((string) $resource, strlen($this->file . "resources/")));
|
$path = str_replace(DIRECTORY_SEPARATOR, "/", substr((string) $resource, strlen($this->file)));
|
||||||
$resources[$path] = $resource;
|
$resources[$path] = $resource;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ class PluginManager{
|
|||||||
* @var Plugin $plugin
|
* @var Plugin $plugin
|
||||||
* @see Plugin::__construct()
|
* @see Plugin::__construct()
|
||||||
*/
|
*/
|
||||||
$plugin = new $mainClass($loader, $this->server, $description, $dataFolder, $prefixed, new DiskResourceProvider($prefixed . "/"));
|
$plugin = new $mainClass($loader, $this->server, $description, $dataFolder, $prefixed, new DiskResourceProvider($prefixed . "/resources/"));
|
||||||
$this->plugins[$plugin->getDescription()->getName()] = $plugin;
|
$this->plugins[$plugin->getDescription()->getName()] = $plugin;
|
||||||
|
|
||||||
return $plugin;
|
return $plugin;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user