add shitty documentation to FileSystem
This commit is contained in:
parent
6d0ec8d1e5
commit
217580ab1f
1 changed files with 16 additions and 0 deletions
|
@ -13,8 +13,16 @@ namespace Sakura;
|
||||||
*/
|
*/
|
||||||
class FileSystem
|
class FileSystem
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Cached copy of the root path.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
private static $rootPath = null;
|
private static $rootPath = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resolves the root path.
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public static function getRootPath()
|
public static function getRootPath()
|
||||||
{
|
{
|
||||||
if (self::$rootPath === null) {
|
if (self::$rootPath === null) {
|
||||||
|
@ -25,11 +33,19 @@ class FileSystem
|
||||||
return self::$rootPath;
|
return self::$rootPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fixes a given path to the correct slashes and root.
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public static function getPath($path)
|
public static function getPath($path)
|
||||||
{
|
{
|
||||||
return self::getRootPath() . DIRECTORY_SEPARATOR . self::fixSlashes($path);
|
return self::getRootPath() . DIRECTORY_SEPARATOR . self::fixSlashes($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fixes slashes.
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
private static function fixSlashes($path)
|
private static function fixSlashes($path)
|
||||||
{
|
{
|
||||||
return str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $path);
|
return str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $path);
|
||||||
|
|
Reference in a new issue