public static function getRealPath($path)
{
if (strpos($path, '~') === 0) {
$path = substr_replace($path, $_SERVER['HOME'], 0, 1);
}
$_path = realpath($path);
if (!empty($path) && $_path !== false) {
return rtrim($_path, DIRECTORY_SEPARATOR);
}
return false;
}