merge paths into a single place.
This commit is contained in:
56
paths.php
Normal file
56
paths.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
// --------------------------------------------------------------
|
||||
// Initialize the web variable if it doesn't exist.
|
||||
// --------------------------------------------------------------
|
||||
if ( ! isset($web)) $web = false;
|
||||
|
||||
// --------------------------------------------------------------
|
||||
// Define the directory separator for the environment.
|
||||
// --------------------------------------------------------------
|
||||
define('DS', DIRECTORY_SEPARATOR);
|
||||
|
||||
// --------------------------------------------------------------
|
||||
// The path to the application directory.
|
||||
// --------------------------------------------------------------
|
||||
$paths['APP_PATH'] = 'application';
|
||||
|
||||
// --------------------------------------------------------------
|
||||
// The path to the bundles directory.
|
||||
// --------------------------------------------------------------
|
||||
$paths['BUNDLE_PATH'] = 'bundles';
|
||||
|
||||
// --------------------------------------------------------------
|
||||
// The path to the storage directory.
|
||||
// --------------------------------------------------------------
|
||||
$paths['STORAGE_PATH'] = 'storage';
|
||||
|
||||
// --------------------------------------------------------------
|
||||
// The path to the Laravel directory.
|
||||
// --------------------------------------------------------------
|
||||
$paths['SYS_PATH'] = 'laravel';
|
||||
|
||||
// --------------------------------------------------------------
|
||||
// The path to the public directory.
|
||||
// --------------------------------------------------------------
|
||||
if ($web)
|
||||
{
|
||||
define('PUBLIC_PATH', realpath('').DS);
|
||||
}
|
||||
else
|
||||
{
|
||||
$paths['PUBLIC_PATH'] = 'public';
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------
|
||||
// Define each constant if it hasn't been defined.
|
||||
// --------------------------------------------------------------
|
||||
foreach ($paths as $name => $path)
|
||||
{
|
||||
if ( ! defined($name))
|
||||
{
|
||||
$path = ($web) ? '../'.$path : $path;
|
||||
|
||||
define($name, realpath($path).DS);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user