mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-09 05:08:36 +00:00
PluginBase::getResources() returns associative array (#2193)
Now, it has string keys, which is the path of the resource file relative to the resources folder.
This commit is contained in:
parent
b9718f9e87
commit
8704d378d4
@ -226,7 +226,7 @@ abstract class PluginBase implements Plugin{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all the resources packaged with the plugin
|
* Returns all the resources packaged with the plugin in the form ["path/in/resources" => SplFileInfo]
|
||||||
*
|
*
|
||||||
* @return \SplFileInfo[]
|
* @return \SplFileInfo[]
|
||||||
*/
|
*/
|
||||||
@ -235,7 +235,8 @@ abstract class PluginBase implements Plugin{
|
|||||||
if(is_dir($this->file . "resources/")){
|
if(is_dir($this->file . "resources/")){
|
||||||
foreach(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->file . "resources/")) as $resource){
|
foreach(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->file . "resources/")) as $resource){
|
||||||
if($resource->isFile()){
|
if($resource->isFile()){
|
||||||
$resources[] = $resource;
|
$path = str_replace(DIRECTORY_SEPARATOR, "/", substr((string) $resource, strlen($this->file . "resources/")));
|
||||||
|
$resources[$path] = $resource;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user