Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Copying a directory
  • Hello everyone, I am trying to copy a directory from: /myappdir/fuel/app/config/project_template to: /myappdir/public/projects/test This is the general code I am using: File::copy_dir(APPPATH.'config/project_template', DOCROOT.'projects/test'); When I do this, I get the following error:
    Fuel\Core\InvalidPathException [ Error ]: Invalid basepath, cannot create directory at this location. COREPATH/classes/file.php @ line 146
    In looking at the Fuel code in /core/file.php on line 489 I see this:
    $check = static::create_dir($new_path.path.DS, $file, fileperms($path.$file.DS) ?: 0777, $area);
    This does not look right to me, because <strong>path</strong> is neither a variable nor a constant as far as I can tell. While this may not be the complete reason for the issue I am having, it does seem to be a part of it. Does anyone else have any insight into this? Has anyone else been able to successfully copy a directory? Thank you in advance. FuelPHP is really shaping up to be a fantastic little framework. Thank you! I will be looking further into file.php to see if I can track this down. Best,
    Joe Dakroub
  • Yeah, I've been playing around with this and it does not copy anything, even a directory with one file in it, due to the nature of the way the method has been coded. I am looking into it now to understand what the intent was and see if I can fix it. Thank you.
  • You're right, I added the $ in the develop branch.
  • Thank you, that certainly helps. However, this does not seem to fix the issue with the create_dir() method. It seems that the method gets a list of all the files and directories around line 476, then iterates over the list. The problem is that the code does not seem to account for the directories in the list, just the files. Is the intent of the create_dir() method to just copy a directory of files? Thank you for your time.
  • It should copy both, if it really doesn't try to track it down and pull-request or post an issue on github.

Howdy, Stranger!

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

In this Discussion