public static bool DownloadPackages(string packagePath, RunSettings runSettings, out PackageInfomarionMapping pkgInfoMap) { pkgInfoMap = new PackageInfomarionMapping(); if (string.IsNullOrWhiteSpace(packagePath) || string.IsNullOrWhiteSpace(runSettings.OutputPath)) { return(false); } var packages = GetPackagesFromFile(packagePath); PreparePropertyBag(packages); foreach (var package in packages) { // Package resolver that will be used to get the full path to binaries. IPackageResolver resolver = new Resolver(); var currentOutputPrefix = Guid.NewGuid().ToString().Substring(0, 5); var isSuccess = resolver.CopyBinarySet(package, runSettings, pkgInfoMap, currentOutputPrefix); try { Console.WriteLine($"[info] Deleting {Path.Combine(runSettings.OutputPath, "_pacman" + currentOutputPrefix)}"); Helpers.DeleteDirectory(Path.Combine(runSettings.OutputPath, "_pacman" + currentOutputPrefix)); } catch { Console.WriteLine("[error] Errored out the first time we tried to delete the folder. Retrying..."); Thread.Sleep(2000); Helpers.DeleteDirectory(Path.Combine(runSettings.OutputPath, "_pacman" + currentOutputPrefix)); } } return(true); }