generated from spawnia/php-package-template
-
-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Labels
bugAn error within SailorAn error within Sailor
Description
Describe the bug
Under Windows, running the command to generate code includes a relative path to the configuration file that goes all the way to the root of the Windows drive. So instead of having something like that:
public static function config(): string
{
return \Safe\realpath(__DIR__ . '/../../../../../sailor.php');
}We obtain something like the following:
public static function config(): string
{
return \Safe\realpath(__DIR__ . '/../../../../../../C:\Users\johndoe\Documents\dev\project\website\sailor.php');
}Expected behavior/Solution
Regardless of operating system, we should get the short form of relative path.
Steps to reproduce
- Be under Windows
- Run the code generator
Output/Logs
Nothing of importance.
How to get around the issue
Change \Spawnia\Sailor\Codegen\Generator::configPath this way:
protected function configPath(string $directory): string
{
// $from = explode('/', $directory);
// $to = explode('/', $this->configFile);
$from = preg_split('~[\\\\/]~', $directory);
$to = preg_split('~[\\\\/]~', $this->configFile);I am not having much time on my hand to do a PR. If nobody does, I'll see if I can get to it.
Metadata
Metadata
Assignees
Labels
bugAn error within SailorAn error within Sailor