Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
FileSystemLoader baseDir must be a directory: UTF-8
  • Everything worked fine on Linux httpd, and so tried moving all files to windows 10 httpd, php 5.6.9 but now get this error. How would I fix this? and to understand better is UTF-8 some folder that is trying to be created on windows?

    I have user controller and trying to load the user/index page. Yes, using in the controller a View::forge('user/connect.mustache'  ...etc. 

    Mustache_Exception_RuntimeException [ Error ]:
    FilesystemLoader baseDir must be a directory: UTF-8

    C:/wwwroot/test/fuel/vendor/mustache/mustache/src/Mustache/Loader/FilesystemLoader.php @ line 59
    54            $this->baseDir = realpath($this->baseDir);
    55        }
    56
    57        if (!is_dir($this->baseDir)) {
    58           
    59            throw new Mustache_Exception_RuntimeException(sprintf('FilesystemLoader baseDir must be a directory: %s', $baseDir));
    60        }
    61
    62        if (array_key_exists('extension', $options)) {
    63            if (empty($options['extension'])) {
    64                $this->extension = '';

    Backtrace
    1. C:/wwwroot/test/fuel/packages/parser/classes/view/mustache.php @ line 76
    2. C:/wwwroot/test/fuel/packages/parser/classes/view/mustache.php @ line 31
    3. C:/wwwroot/test/fuel/core/classes/view.php @ line 665
    4. C:/wwwroot/test/fuel/core/classes/view.php @ line 213
    5. C:/wwwroot/test/fuel/app/views/template.php @ line 80
    6. C:/wwwroot/test/fuel/core/classes/view.php @ line 244
    7. C:/wwwroot/test/fuel/core/classes/view.php @ line 260
    8. C:/wwwroot/test/fuel/core/classes/view.php @ line 665
    9. C:/wwwroot/test/fuel/core/classes/view.php @ line 213
    10. C:/wwwroot/test/fuel/core/classes/response.php @ line 382
    11. C:/wwwroot/test/public/index.php @ line 113


    I have already changed the app/development/config.php to have 'en-US' because windows needs a dash instead of an underscore compared to how it works on linux with 'en_US'. This got rid of the error "Fuel\Core\Fuel::init - The configured locale en_US is not installed on your system."

    #app/development/config.php
    <?php
    return array(
            'profiling' => true,
            'locale' => 'en-US',

    );

    #app/config.php

    return array(

       'always_load' => array(
          'packages' => array(
             'orm',

             'auth',

             'parser',

        ),
        'locale' => 'en-US',
    ),

    Now when comparing profiling's Config tab I noticed something these 2 below have "/" at the end but doesn't look right. Probably not the cause, but also wanted to include.

    cache_dir
    C:\wwwroot\test\fuel\app\cache/

    log_path
    C:\wwwroot\test\fuel\app\logs/

  • How did you install Mustache? 

    This is not a Fuel error, it is Mustaches file loader that complains it can't find the "UTF-8" directory. Not a rights issue?

    The last two are cosmetic, PHP doesn't really care, but this is because in the core/config/config.php these trailing slashes are hardcoded, instead of using the system contant DS. I'll push an update for this issue. 
  • So I tried looking online on how to properly install mustache on windows and if other people had this issue before.. but couldn't find anything good enough to follow.

    I decided to just work around it for now. My temporary solution was to add a hardcoded value in the FilesystemLoader.php file that sets the $this->baseDir value.

    Go to C:\wwwroot\test\fuel\vendor\mustache\mustache\src\Mustache\Loader\FilesystemLoader.php

    Add to line #56 a valid directory. This can be any directory that exists and in my example I just used the tmp dir in fuel/app/tmp like this:

    $this->baseDir = 'C:/wwwroot/test/fuel/app/tmp';

    This is just a workaround and prevents line #59 runtime exception. Also, allows me to continue to use fuelphp with mustache on windows.

    Hope this helps!

     

  • I feel very ashamed at the moment.

    Found this issue, a stupid copy and paste error, fixed here: https://github.com/fuel/parser/commit/765b4a2676f87d9b1e0ead524181563207a54e7d

    Sorry about this... :-(
  • That's okay! I just tested the fix.. and it works great now on windows!

    C:\wwwroot\test\fuel\packages\parser\classes\view\mustache.php

    Line #74

    if ($partials = \Config::get('parser.View_Mustache.environment.partials_loader', array()))

    I am happy to have supported and I'm glad that I can remove my workaround.

    Thank you for the follow up.

    FuelPHP is awesome!

     

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion