Closed szaleq closed 7 months ago
Yeah, $vendorDir = $config->getVendorDirectory()
is a relative path on my Mac, i.e. just vendor/
, meant to be relative from the project root.
I'm aware it doesn't work on Windows, see #30 for possible cause/solution.
Unfortunately I don't have or use a Windows computer myself, so the motivation to resolve this has been low. (i.e. I fix easier to fix problems first!)
I did add Windows to the GitHub Actions CI text matrix recently: https://github.com/BrianHenryIE/strauss/commit/457b53c719879a6f978227bb5f33396c9bba8dc4, so I do intend to address this, and your issue might help quite a bit.
It looks like something is going wrong here: https://github.com/BrianHenryIE/strauss/blob/f015905edefe603c0841a4bec088c1b8fdaecafc/src/Composer/ProjectComposerPackage.php#L49
That should work now. Please test dev-master
and let me know. https://github.com/BrianHenryIE/strauss/commit/148caba0c02b3e1b45d4f7bead15464c78458303
@BrianHenryIE Thaks for the quick action. Unfortunately, it still does not work, now with the following error:
Unable to read file from location: vendor/src/I:/strauss-example/vendor/brianhenryie/strauss/src/Autoload.php. file_get_contents(I:\strauss-example\vendor/src/I:/strauss-example/vendor/brianhenryie/strauss/src/Autoload.php): Failed to open stream: No such file or directory
I've updated the Strauss version to dev-master
in the repo linked above.
Strauss creates invalid "relative" file paths on Windows, which are actually absolute. It causes an error:
Unable to read file from location: (...)
, because it prepends the so called relative path with an absolute project path, creating paths which contain the absolute project base path twice.Steps to reproduce
composer install
composer prefix-namespaces
The solution
Here there is a line, which creates "relative" source file path using
$vendorDir
, which is an absolute path (at least on Windows - IDK how it behaves in other environments). Instead the$workingDir
could be subtracted from the$sourceAbsolutePath
to create a relative path (which actually works):