Skip to content
This repository has been archived by the owner on Jul 16, 2020. It is now read-only.

Merge folder and php file existing at the same time #117

Open
limi7break opened this issue Mar 6, 2020 · 0 comments
Open

Merge folder and php file existing at the same time #117

limi7break opened this issue Mar 6, 2020 · 0 comments

Comments

@limi7break
Copy link

limi7break commented Mar 6, 2020

If in a folder I have a php file and a folder with the same name, the generator does not merge them in the generated file: sometimes the file is picked and the folder is ignored, sometimes the opposite.
I don't know if this behavior is intended, but I think both the file and the folder should be recursively merged into the generated file.

This modification of Generator.php resolves this issue:

at line 218:

if ($fileinfo->isDir()) {
    // Recursivley iterate through subdirs, until everything is allocated.

    if (array_key_exists($fileinfo->getFilename(), $data)) {
        $data[$fileinfo->getFilename()] = array_merge_recursive($data[$fileinfo->getFilename()], $this->allocateLocaleArray($path . DIRECTORY_SEPARATOR .     $fileinfo->getFilename()));
    } else {
        $data[$fileinfo->getFilename()] = $this->allocateLocaleArray($path . DIRECTORY_SEPARATOR . $fileinfo->getFilename());
    }
}

if ($fileinfo->isFile()) {
    $noExt = $this->removeExtension($fileinfo->getFilename());

[...]

if (array_key_exists($noExt, $data)) {
    $data[$noExt] = array_merge_recursive($data[$noExt], $this->adjustArray($tmp));
} else {
    $data[$noExt] = $this->adjustArray($tmp);
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant