Welcome Guest, Not a member yet? Register   Sign In
Publisher, add ability to create destination-folders
#1
Lightbulb 
(This post was last modified: 03-11-2022, 05:16 AM by haugli92.)

Hei!
Ref: https://codeigniter4.github.io/userguide...isher.html

Is it possible to add ability to create destination-folders?

protected $destination = FCPATH . 'assets/vendor/bootstrap-icons';

Currently the Publisher class validates if the directory is valid on __construct, which make it hard to do anything before the publish.

Workaround: Add custom __contruct to your Publisher-class.

BootstrapPublisher.php
PHP Code:
  public function __construct(?string $source null, ?string $destination null) {
    if(!is_dir($this->destination)) {
      mkdir($this->destination0755true);
    }
    
    parent
::__construct($source$destination);
  


Regards
Haugli92
Reply
#2

I'm not sure it is a bug or not.
But it seems a bug.
@MGatner ?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB