From cb9b6ab1d1b63617f8f3b3d7f74b90d241b0f1be Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Sat, 1 Nov 2014 19:23:10 +0100 Subject: [PATCH] Fixed server not using the correct provided path if it did not exist --- src/pocketmine/PocketMine.php | 4 ++-- src/pocketmine/Server.php | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/pocketmine/PocketMine.php b/src/pocketmine/PocketMine.php index 18493335a..a60f629a3 100644 --- a/src/pocketmine/PocketMine.php +++ b/src/pocketmine/PocketMine.php @@ -121,8 +121,8 @@ namespace pocketmine { $opts = getopt("", ["enable-ansi", "disable-ansi", "data:", "plugins:", "no-wizard", "enable-profiler"]); - define("pocketmine\\DATA", isset($opts["data"]) ? realpath($opts["data"]) . DIRECTORY_SEPARATOR : \getcwd() . DIRECTORY_SEPARATOR); - define("pocketmine\\PLUGIN_PATH", isset($opts["plugins"]) ? realpath($opts["plugins"]) . DIRECTORY_SEPARATOR : \getcwd() . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR); + define("pocketmine\\DATA", isset($opts["data"]) ? $opts["data"] . DIRECTORY_SEPARATOR : \getcwd() . DIRECTORY_SEPARATOR); + define("pocketmine\\PLUGIN_PATH", isset($opts["plugins"]) ? $opts["plugins"] . DIRECTORY_SEPARATOR : \getcwd() . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR); define("pocketmine\\ANSI", (Utils::getOS() !== "win" or isset($opts["enable-ansi"])) and !isset($opts["disable-ansi"])); diff --git a/src/pocketmine/Server.php b/src/pocketmine/Server.php index 6b256479d..d8d8392a4 100644 --- a/src/pocketmine/Server.php +++ b/src/pocketmine/Server.php @@ -1455,11 +1455,12 @@ class Server{ $this->autoloader = $autoloader; $this->logger = $logger; $this->filePath = $filePath; - $this->dataPath = $dataPath; - $this->pluginPath = $pluginPath; - @mkdir($this->dataPath . "worlds/", 0777, true); - @mkdir($this->dataPath . "players/", 0777); - @mkdir($this->pluginPath, 0777); + @mkdir($dataPath . "worlds/", 0777, true); + @mkdir($dataPath . "players/", 0777); + @mkdir($pluginPath, 0777); + + $this->dataPath = realpath($dataPath); + $this->pluginPath = realpath($pluginPath); $this->entityMetadata = new EntityMetadataStore(); $this->playerMetadata = new PlayerMetadataStore();