mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
Merge pull request #51 from christianrondeau/issue-43
Issue #43: if a nupkg file already exists, overwrite it
This commit is contained in:
@@ -23,22 +23,27 @@ namespace Squirrel
|
||||
{
|
||||
progress = progress ?? (_ => { });
|
||||
urlDownloader = urlDownloader ?? new FileDownloader();
|
||||
var packagesDirectory = Path.Combine(rootAppDirectory, "packages");
|
||||
|
||||
int current = 0;
|
||||
int toIncrement = (int)(100.0 / releasesToDownload.Count());
|
||||
|
||||
if (Utility.IsHttpUrl(updateUrlOrPath)) {
|
||||
await releasesToDownload.ForEachAsync(async x => {
|
||||
var targetFile = Path.Combine(packagesDirectory, x.Filename);
|
||||
File.Delete(targetFile);
|
||||
await urlDownloader.DownloadFile(
|
||||
String.Format("{0}/{1}", updateUrlOrPath, x.Filename),
|
||||
Path.Combine(rootAppDirectory, "packages", x.Filename));
|
||||
targetFile);
|
||||
lock (progress) progress(current += toIncrement);
|
||||
});
|
||||
} else {
|
||||
await releasesToDownload.ForEachAsync(x => {
|
||||
var targetFile = Path.Combine(packagesDirectory, x.Filename);
|
||||
File.Copy(
|
||||
Path.Combine(updateUrlOrPath, x.Filename),
|
||||
Path.Combine(rootAppDirectory, "packages", x.Filename));
|
||||
targetFile,
|
||||
true);
|
||||
lock (progress) progress(current += toIncrement);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user