mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-18 20:14:31 +00:00
Start using webmozart/pathutil for joining paths (#4287)
This commit is contained in:
@@ -31,6 +31,7 @@ use pocketmine\scheduler\TaskScheduler;
|
||||
use pocketmine\Server;
|
||||
use pocketmine\utils\AssumptionFailedError;
|
||||
use pocketmine\utils\Config;
|
||||
use Webmozart\PathUtil\Path;
|
||||
use function count;
|
||||
use function dirname;
|
||||
use function fclose;
|
||||
@@ -86,7 +87,7 @@ abstract class PluginBase implements Plugin, CommandExecutor{
|
||||
$this->dataFolder = rtrim($dataFolder, "/" . DIRECTORY_SEPARATOR) . "/";
|
||||
//TODO: this is accessed externally via reflection, not unused
|
||||
$this->file = rtrim($file, "/" . DIRECTORY_SEPARATOR) . "/";
|
||||
$this->configFile = $this->dataFolder . "config.yml";
|
||||
$this->configFile = Path::join($this->dataFolder, "config.yml");
|
||||
|
||||
$prefix = $this->getDescription()->getPrefix();
|
||||
$this->logger = new PluginLogger($server->getLogger(), $prefix !== "" ? $prefix : $this->getName());
|
||||
@@ -261,7 +262,7 @@ abstract class PluginBase implements Plugin, CommandExecutor{
|
||||
return false;
|
||||
}
|
||||
|
||||
$out = $this->dataFolder . $filename;
|
||||
$out = Path::join($this->dataFolder, $filename);
|
||||
if(!file_exists(dirname($out))){
|
||||
mkdir(dirname($out), 0755, true);
|
||||
}
|
||||
|
@@ -39,6 +39,7 @@ use pocketmine\Server;
|
||||
use pocketmine\timings\TimingsHandler;
|
||||
use pocketmine\utils\AssumptionFailedError;
|
||||
use pocketmine\utils\Utils;
|
||||
use Webmozart\PathUtil\Path;
|
||||
use function array_intersect;
|
||||
use function array_merge;
|
||||
use function class_exists;
|
||||
@@ -59,7 +60,6 @@ use function shuffle;
|
||||
use function stripos;
|
||||
use function strpos;
|
||||
use function strtolower;
|
||||
use const DIRECTORY_SEPARATOR;
|
||||
|
||||
/**
|
||||
* Manages all the plugins
|
||||
@@ -121,9 +121,9 @@ class PluginManager{
|
||||
|
||||
private function getDataDirectory(string $pluginPath, string $pluginName) : string{
|
||||
if($this->pluginDataDirectory !== null){
|
||||
return $this->pluginDataDirectory . $pluginName;
|
||||
return Path::join($this->pluginDataDirectory, $pluginName);
|
||||
}
|
||||
return dirname($pluginPath) . DIRECTORY_SEPARATOR . $pluginName;
|
||||
return Path::join(dirname($pluginPath), $pluginName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user