From d107d6d950b38b46fba58488c201d5cac35be156 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Tue, 7 Feb 2017 11:01:55 +0100 Subject: Allow to omit trailing slash in config paths --- application/config/config.php | 6 +++--- system/core/Exceptions.php | 12 ++++++++++++ system/core/Log.php | 4 +++- system/core/Output.php | 2 +- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/application/config/config.php b/application/config/config.php index c6e1a7af5..72e79bee9 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -221,7 +221,7 @@ $config['log_threshold'] = 0; |-------------------------------------------------------------------------- | | Leave this BLANK unless you would like to set something other than the default -| application/logs/ directory. Use a full server path with trailing slash. +| application/logs/ directory. Use a full server path. | */ $config['log_path'] = ''; @@ -269,7 +269,7 @@ $config['log_date_format'] = 'Y-m-d H:i:s'; |-------------------------------------------------------------------------- | | Leave this BLANK unless you would like to set something other than the default -| application/views/errors/ directory. Use a full server path with trailing slash. +| application/views/errors/ directory. Use a full server path. | */ $config['error_views_path'] = ''; @@ -280,7 +280,7 @@ $config['error_views_path'] = ''; |-------------------------------------------------------------------------- | | Leave this BLANK unless you would like to set something other than the default -| application/cache/ directory. Use a full server path with trailing slash. +| application/cache/ directory. Use a full server path. | */ $config['cache_path'] = ''; diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index 47d153f49..806598921 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -161,6 +161,10 @@ class CI_Exceptions { { $templates_path = VIEWPATH.'errors'.DIRECTORY_SEPARATOR; } + else + { + $templates_path = rtrim($templates_path, '/\\').DIRECTORY_SEPARATOR; + } if (is_cli()) { @@ -194,6 +198,10 @@ class CI_Exceptions { { $templates_path = VIEWPATH.'errors'.DIRECTORY_SEPARATOR; } + else + { + $templates_path = rtrim($templates_path, '/\\').DIRECTORY_SEPARATOR; + } $message = $exception->getMessage(); if (empty($message)) @@ -240,6 +248,10 @@ class CI_Exceptions { { $templates_path = VIEWPATH.'errors'.DIRECTORY_SEPARATOR; } + else + { + $templates_path = rtrim($templates_path, '/\\').DIRECTORY_SEPARATOR; + } $severity = isset($this->levels[$severity]) ? $this->levels[$severity] : $severity; diff --git a/system/core/Log.php b/system/core/Log.php index 5be7baea8..67b315b6b 100644 --- a/system/core/Log.php +++ b/system/core/Log.php @@ -124,7 +124,9 @@ class CI_Log { isset(self::$func_override) OR self::$func_override = (extension_loaded('mbstring') && ini_get('mbstring.func_override')); - $this->_log_path = ($config['log_path'] !== '') ? $config['log_path'] : APPPATH.'logs/'; + $this->_log_path = ($config['log_path'] !== '') + ? rtrim($config['log_path'], '/\\').DIRECTORY_SEPARATOR : APPPATH.'logs'.DIRECTORY_SEPARATOR; + $this->_file_ext = (isset($config['log_file_extension']) && $config['log_file_extension'] !== '') ? ltrim($config['log_file_extension'], '.') : 'php'; diff --git a/system/core/Output.php b/system/core/Output.php index 0887717d9..2cdb9808c 100644 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -554,7 +554,7 @@ class CI_Output { { $CI =& get_instance(); $path = $CI->config->item('cache_path'); - $cache_path = ($path === '') ? APPPATH.'cache/' : $path; + $cache_path = ($path === '') ? APPPATH.'cache'.DIRECTORY_SEPARATOR : rtrim($path, '/\\').DIRECTORY_SEPARATOR; if ( ! is_dir($cache_path) OR ! is_really_writable($cache_path)) { -- cgit v1.2.3-24-g4f1b