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

Box as a composer dependency cannot find the correct autoload.php #155

Open
wants to merge 1 commit into
base: 2.0
Choose a base branch
from

Conversation

tomzx
Copy link

@tomzx tomzx commented Oct 9, 2016

I'm not sure if this change actually breaks existing behavior, but I think the idea was that if you found a composer.json file, you wanted to exit the do-while loop, not exit only when the while condition is true.

I've added a skip = 1 because we obviously want to skip the composer.json in the box directory (vendor/kerge/box).

@kherge
Copy link
Contributor

kherge commented Oct 10, 2016

Hi @tomzx, are you using a custom vendor directory location in your composer.json file?

@tomzx
Copy link
Author

tomzx commented Oct 11, 2016

@kherge, Nope, just the default vendor folder.

The structure of my project is

composer.json
vendor
- kherge
-- box

I run box using vendor/bin/box on Windows. I think this might be the source of the issue. It appears that under unix variants the box shell script is copied to the vendor/bin folder, while on Windows it simply creates a script that will call the box script from within its folder (so the current working directory is different).

Thus, while realpath($_SERVER['argv'][0]) will return vendor/bin/box under unix variants, it will return vendor/kherge/box/bin/box. Thus, it seems that my fix would most likely break under unix variants.

One suggestion would be to check if the second directory starting from the right is box.
Another one would be to have different behavior based on the platform.
A third one would be to search for any composer.json that does not contain kherge/box as its name, starting from the current script execution path.
There's probably plenty of other ways, although I'm not sure which one is the most appropriate one.

@kherge kherge self-assigned this Oct 11, 2016
@theofidry
Copy link
Member

Fixed in box-project/box#3

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants