Sources "%s" and "%s" overlap #133

Closed
mhujer opened this Issue Apr 6, 2012 · 3 comments

Comments

Projects
None yet
4 participants

mhujer commented Apr 6, 2012

When I have two directories with the same beginning on the same level and I try to use the both as sources.

  • foo

  • foo-bar

    apigen -s foo -s foo-bar -d out

    ApiGen 2.6.1

    Sources "foo-bar" and "foo" overlap.

https://github.com/apigen/apigen/blob/develop/ApiGen/Config.php#L354-360

Contributor

Andrewsville commented Apr 6, 2012

I have a feeling this overlapping check is a relict from the good old ApiGen 1. This was the way how to prevent a file to be processed (and included) multiple times causing a possible fatal error (redeclaring a class). Looking at how the file list is built in Generator, I would say this whole check can be removed.

@kukulich?

I just ran a local test because I was having the same issue and found that if you add the following after line 280 of Config.php, the problem is resolved, because the two paths become distinct.

if( is_dir($value) ) {
  $value .= DIRECTORY_SEPARATOR;
}

This simply ensures there is a trailing slash (backslash for Windows) if $value is a directory.

Contributor

Andrewsville commented Apr 14, 2012

I've just commited a change that fixes this issue :)
The check is not necessary because it is technically impossible to process a single file multiple times (full patname is used as an array index).

kukulich closed this Jul 14, 2012

Andrewsville was assigned Jul 14, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment