Welcome Guest, Not a member yet? Register   Sign In
Confusing About DIRECTORY_SEPARATOR
#1

Hi,

I'm confusing about DIRECTORY_SEPARATOR. I encountered some errors in folder structure during theme usage. Here is my folder structure.

Code:
├───app
├───public
├───system
├───ThirdParty
│   └───Site
│       ├───Config
│       ├───Controllers
│       │   └───Common
│       ├───Database
│       │   ├───Migrations
│       │   └───Seeds
│       ├───Helpers
│       ├───Language
│       ├───Models
│       └───Views
│           └───theme
│               └───jango
│                   ├───assets
│                   └───common
└───writable


When i try to reach my headerView.php codeigniter shows error "Invalid file: Site\Views\theme\jango\common\headerView.php

After some research i found some code blocks under FileLocator  (system/Autoloader/FileLocator.php)
PHP Code:
protected function getNamespaces(string $prefix null) {
        if (
$prefix) {
            
$path $this->autoloader->getNamespace($prefix);

            return isset(
$path[0])
                ? 
rtrim($path[0], DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR
                
'';
        }

        
$namespaces = [];

        foreach (
$this->autoloader->getNamespace() as $prefix => $paths) {
            foreach (
$paths as $path) {
                
$namespaces[] = [
                    
'prefix' => $prefix,
                    
'path'   => rtrim($pathDIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR,
                ];
            }
        }

        return 
$namespaces;
    } 

when i change
Code:
? rtrim($path[0], DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR
to
? rtrim($path[0], DIRECTORY_SEPARATOR) . '/'


my problem solves. But it's core file. Do i have to change ? 

I'm using Windows 10 and Lastest version of WAMP (3.1.9), PHP 7.3.5


Best Wishes  Angel
Reply




Theme © iAndrew 2016 - Forum software by © MyBB