diff --git a/lib/license_finder/package_managers/cargo.rb b/lib/license_finder/package_managers/cargo.rb index 36489a9f8..0135a2e63 100644 --- a/lib/license_finder/package_managers/cargo.rb +++ b/lib/license_finder/package_managers/cargo.rb @@ -6,7 +6,8 @@ module LicenseFinder class Cargo < PackageManager def current_packages cargo_output.map do |package| - CargoPackage.new(package, logger: logger) + path = Dir.glob("#{Dir.home}/.cargo/registry/src/**/#{package['name']}-#{package['version']}").first + CargoPackage.new(package, logger: logger, install_path: path) end end diff --git a/lib/license_finder/package_managers/composer.rb b/lib/license_finder/package_managers/composer.rb index d2039799f..8e91815b6 100644 --- a/lib/license_finder/package_managers/composer.rb +++ b/lib/license_finder/package_managers/composer.rb @@ -12,7 +12,11 @@ def possible_package_paths def current_packages dependency_list.map do |name, dependency| - ComposerPackage.new(name, dependency['version'], spec_licenses: dependency['license']) + path_command = "composer show #{name} -P" + stdout, _stderr, status = Dir.chdir(project_path) { Cmd.run(path_command) } + + path = status.success? ? stdout.split(' ').last : '' + ComposerPackage.new(name, dependency['version'], spec_licenses: dependency['license'], install_path: path) end end diff --git a/lib/license_finder/package_managers/sbt.rb b/lib/license_finder/package_managers/sbt.rb index 63fa41821..234330712 100644 --- a/lib/license_finder/package_managers/sbt.rb +++ b/lib/license_finder/package_managers/sbt.rb @@ -30,7 +30,9 @@ def current_packages 'version' => version, 'licenses' => [{ 'name' => row['License'] }] } - SbtPackage.new(spec, logger: logger, include_groups: @include_groups) + + path = File.join("#{Dir.home}/.ivy2/cache", "#{spec['groupId']}/#{spec['artifactId']}") + SbtPackage.new(spec, logger: logger, include_groups: @include_groups, install_path: path) end end