Skip to content

Commit

Permalink
fix: filepart marked as downloaded
Browse files Browse the repository at this point in the history
  • Loading branch information
edshPC committed Aug 22, 2024
1 parent 7318095 commit 345dc50
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion MCLauncher/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ private void InvokeDownload(Version v) {
}
try {
Directory.CreateDirectory(DOWNLOADS_FOLDER);
await downloader.Download(v.UUID, "1", dlPath, (current, total) => {
string tmpPath = dlPath + ".filepart";
await downloader.Download(v.UUID, "1", tmpPath, (current, total) => {
if (v.StateChangeInfo.VersionState != VersionState.Downloading) {
Debug.WriteLine("Actual download started");
v.StateChangeInfo.VersionState = VersionState.Downloading;
Expand All @@ -172,6 +173,7 @@ await downloader.Download(v.UUID, "1", dlPath, (current, total) => {
}
v.StateChangeInfo.DownloadedBytes = current;
}, cancelSource.Token);
File.Move(tmpPath, dlPath);
Debug.WriteLine("Download complete");
} catch (BadUpdateIdentityException) {
Debug.WriteLine("Download failed due to failure to fetch download URL");
Expand Down

0 comments on commit 345dc50

Please sign in to comment.