Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working directory error #15

Merged
merged 2 commits into from
Apr 26, 2023
Merged

Conversation

fredden
Copy link
Contributor

@fredden fredden commented Apr 26, 2023

While working to implement the new interface created in #14, I encountered an error when the working directory is not the same as the Composer root directory. This pull request replaces the call to \getcwd() with a new resolver method to retrieve the correct directory.

@@ -46,7 +46,9 @@ private function getPackages(OutputInterface $output): array
private function getVendorState(array $packages): array
{
return [
'id' => $this->hasher->generateInstallIdHash(getcwd()),
'id' => $this->hasher->generateInstallIdHash(
$this->packageResolverStrategy->getRootDirectory()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I'm not currently behind a computer, but shouldn't this then be resolveRootPath rather than getRootDirectory? I do not see the latter defined anywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it should. Thanks for catching this. I had updated this to be correct in .../magento/vendor/sansec/..., but clearly didn't copy it out to where I committed from. I had initially created this as getRootDirectory() everywhere, but decided it'd be best to keep with the existing naming convention of 'resolveThing()'.

@danslo
Copy link
Contributor

danslo commented Apr 26, 2023

Let's go for it. Thanks for the contribution 🙏

@danslo danslo merged commit 8274e87 into sansecio:main Apr 26, 2023
@fredden fredden deleted the working-directory-error branch April 27, 2023 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants