private IReadOnlyCollection <IFile> GetToolFiles(PackageReference package, ModulesInstallationLocation modulesInstallationLocation = ModulesInstallationLocation.Workdir)
        {
            DirectoryPath modulesPath;

            switch (modulesInstallationLocation)
            {
            case ModulesInstallationLocation.Global:
                modulesPath = GetGlobalPrefix()?.Combine("./bin/") ?? "./bin";
                _log.Verbose($"Found global npm path at: {modulesPath.FullPath}");
                _log.Verbose(
                    "Using global npm binaries folder: installation may succeed without binaries being installed");
                break;

            case ModulesInstallationLocation.Workdir:
                modulesPath = GetLocalInstallPath(package);
                _log.Verbose("Using local install path: " + modulesPath?.FullPath);
                break;

            case ModulesInstallationLocation.Tools:
                modulesPath = GetToolsLocalInstallPath(package);
                _log.Verbose("Using tools install path: " + modulesPath?.FullPath);
                break;

            default:
                throw new ArgumentException("not a known value of InstallationLocation.", nameof(modulesInstallationLocation));
            }

            if (modulesPath == null || !_fileSystem.GetDirectory(modulesPath).Exists)
            {
                throw new System.IO.DirectoryNotFoundException("Could not determine install path!");
            }

            var installRoot = _fileSystem.GetDirectory(modulesPath);

            if (installRoot.Exists)
            {
                return(new ReadOnlyCollection <IFile>(installRoot.GetFiles("*", SearchScope.Recursive).ToList()));
            }

            return(new ReadOnlyCollection <IFile>(new List <IFile>()));
        }
        /// <summary>
        /// Returns the files installed by the given package.
        /// </summary>
        /// <param name="package">The package.</param>
        /// <param name="type">The package type.</param>
        /// <param name="installationLocation">The location in which to install.</param>
        /// <returns>The files installed by the given package.</returns>
        public IReadOnlyCollection <IFile> GetFiles(PackageReference package, PackageType type, ModulesInstallationLocation installationLocation)
        {
            if (type == PackageType.Addin)
            {
                throw new InvalidOperationException("NPM Module does not support Addins'");
            }

            if (type == PackageType.Tool)
            {
                return(GetToolFiles(package, installationLocation));
            }

            throw new InvalidOperationException("Unknown resource type.");
        }