• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.