return \
dirname($fileName);
} public function getShopwareLocation(): string
{ $projectDir =
$this->
getProjectDir();
$composerLookup = \
dirname($projectDir) . '/composer.lock';
// The Shopware installation is always in the "public" directory
if (basename($projectDir) !== 'public'
) { throw InstallerException::
cannotFindShopwareInstallation();
} if (file_exists($composerLookup)) { /** @var array{packages: array{name: string, version: string}[]} $composerJson */
$composerJson =
json_decode((string) file_get_contents($composerLookup), true, \JSON_THROW_ON_ERROR
);
foreach ($composerJson['packages'
] as $package) { if ($package['name'
] === 'shopware/core' ||
$package['name'
] === 'shopware/platform'
) { return \
dirname($composerLookup);
} } }