switch_to_project_root is too flaky
I was having problems setting up a project in chrooted environment and silversmith CLI tool was complaining me I was running it from somewhere else than project root. I decided to look up why and found numerous issues with the switch_to_project_root function, which is also a cause for my original problem. Here's a list of issues listed in no particular order:
- It fails to recognise project directory if it is in root (as in
/project/<various silverstripe directories>) - The manual path constructing is a terrible idea and will fail in some corner cases.
- Seeing that this is project directory for checking if some subdirectory contains
cli-script.phpis flaky to say at least.
I've no idea what version of framework is used though as there's no VERSION file and none of the CLI executables react to --version or version arguments.
Interesting! I had never considered projects living at the root directory. That should be supported for sure.
What is "manual path constructing?" And do you have a less terrible idea that you can offer?
As for the cli-script.php check, it's actually the most certain way to detect the framework directory. If you have any other ideas, I'm keen to hear them, but sake seems to me the least likely thing to change or be moved in future releases.
And forget about the VERSION fie.. Framework hasn't had a reliable version fie since before 2.4. Not sure what happened, but it is frustrating.