• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/composite/helper.php
  • Класс: BitrixMainCompositeHelper
  • Вызов: Helper::makeDirPath
static function makeDirPath($path)
{
	$path = str_replace(array("\", "//"), "/", $path);

	//remove file name
	if (mb_substr($path, -1) != "/")
	{
		$p = mb_strrpos($path, "/");
		$path = mb_substr($path, 0, $p);
	}

	$path = rtrim($path, "/");

	if ($path == "")
	{
		//current folder always exists
		return true;
	}

	if (!file_exists($path))
	{
		return mkdir($path, defined("BX_DIR_PERMISSIONS") ? BX_DIR_PERMISSIONS : 0755, true);
	}

	return is_dir($path);
}