mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-16 03:51:37 +00:00
Merge branch 'stable'
# Conflicts: # resources/vanilla # src/CrashDump.php # src/utils/Utils.php
This commit is contained in:
@@ -53,6 +53,9 @@ final class Filesystem{
|
||||
/** @var resource[] */
|
||||
private static $lockFileHandles = [];
|
||||
|
||||
public const CLEAN_PATH_SRC_PREFIX = "pmsrc";
|
||||
public const CLEAN_PATH_PLUGINS_PREFIX = "plugins";
|
||||
|
||||
private function __construct(){
|
||||
//NOOP
|
||||
}
|
||||
@@ -87,13 +90,13 @@ final class Filesystem{
|
||||
//remove relative paths
|
||||
//TODO: make these paths dynamic so they can be unit-tested against
|
||||
static $cleanPaths = [
|
||||
\pocketmine\PLUGIN_PATH => "plugins", //this has to come BEFORE \pocketmine\PATH because it's inside that by default on src installations
|
||||
\pocketmine\PATH => ""
|
||||
\pocketmine\PLUGIN_PATH => self::CLEAN_PATH_PLUGINS_PREFIX, //this has to come BEFORE \pocketmine\PATH because it's inside that by default on src installations
|
||||
\pocketmine\PATH => self::CLEAN_PATH_SRC_PREFIX
|
||||
];
|
||||
foreach($cleanPaths as $cleanPath => $replacement){
|
||||
$cleanPath = rtrim(str_replace([DIRECTORY_SEPARATOR, "phar://"], ["/", ""], $cleanPath), "/");
|
||||
if(strpos($result, $cleanPath) === 0){
|
||||
$result = ltrim(str_replace($cleanPath, $replacement, $result), "/");
|
||||
$result = ltrim(str_replace($cleanPath, "[$replacement]", $result), "/");
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
|
Reference in New Issue
Block a user