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){
|
||||
$filename = rtrim(str_replace("\\", "/", $filename), "/");
|
||||
if(file_exists($this->file . "/resources/" . $filename)){
|
||||
return fopen($this->file . "/resources/" . $filename, "rb");
|
||||
if(file_exists($this->file . "/" . $filename)){
|
||||
return fopen($this->file . "/" . $filename, "rb");
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -69,10 +69,10 @@ class DiskResourceProvider implements ResourceProvider{
|
||||
*/
|
||||
public function getResources() : array{
|
||||
$resources = [];
|
||||
if(is_dir($this->file . "resources/")){
|
||||
foreach(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->file . "resources/")) as $resource){
|
||||
if(is_dir($this->file)){
|
||||
foreach(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->file)) as $resource){
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ class PluginManager{
|
||||
* @var Plugin $plugin
|
||||
* @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;
|
||||
|
||||
return $plugin;
|
||||
|
Loading…
x
Reference in New Issue
Block a user