merlinthemagic / MTM-Signal

PHP OOP Wrapper for Signal-CLI
10 stars 3 forks source link

Cannot create folder #5

Open Tsjippy opened 2 years ago

Tsjippy commented 2 years ago

Directories.php line 29: $dirObj->setTool($this->getLocalDirectoriesTool()); Will return a '\'. This means any directory path is prefixed with a \ meaning the path is not working on Windows

Tsjippy commented 2 years ago

It is also not working on Ubuntu 22:Fatal error: Uncaught Exception: Cannot Create: /home/simnige1/tmp/sigtest/ cannot write to: / in /home/simnige1/web/simnigeria.org/public_html/wp-content/plugins/sim-plugin/includes/modules/signal/lib/vendor/merlinthemagic/mtm-fs/Src/Tools/Directories/Local.php:128 Stack trace: #0

$this->safePath     = sys_get_temp_dir(). "/sigtest";
$this->clientObj    = \MTM\SignalApi\Facts::getClients()->getSignalCli($this->safePath);
Tsjippy commented 2 years ago

I fixed it on Ubuntu by creating the folder myself:

        $this->safePath   = __DIR__.'/../../data';
        if (!is_dir($this->safePath)) {
            mkdir($this->safePath, 0777, true);
        }

On Windows the folder is not found because of the \ in front of the path