Skip to content

Commit

Permalink
Fix "Value cannot be null. (Parameter 'path')" error when updating vl…
Browse files Browse the repository at this point in the history
…ad sd.next
  • Loading branch information
mohnjiles committed Jul 5, 2023
1 parent b514b2d commit 5c7d3bc
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions StabilityMatrix/Models/Packages/VladAutomatic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using NLog;
using StabilityMatrix.Helper;
using StabilityMatrix.Helper.Cache;
using StabilityMatrix.Models.Progress;
Expand Down Expand Up @@ -136,4 +137,24 @@ void HandleExit(int i)

VenvRunner?.RunDetached(args.TrimEnd(), HandleConsoleOutput, HandleExit, workingDirectory: installedPackagePath);
}

public override async Task<string> Update(InstalledPackage installedPackage, IProgress<ProgressReport>? progress = null)
{
progress?.Report(new ProgressReport(0.1f, message: "Downloading package update...", isIndeterminate: true, type: ProgressType.Download));

var version = await GithubApi.GetAllCommits(Author, Name, installedPackage.InstalledBranch);
var latest = version is {Count: > 0} ? version[0] : null;

if (latest == null)
{
Logger.Warn("No latest version found for vlad");
return string.Empty;
}

await PrerequisiteHelper.RunGit(workingDirectory: installedPackage.FullPath, "pull", "origin", installedPackage.InstalledBranch);

progress?.Report(new ProgressReport(1f, message: "Update Complete", isIndeterminate: true, type: ProgressType.Generic));

return latest.Sha;
}
}
2 changes: 1 addition & 1 deletion StabilityMatrix/ViewModels/PackageManagerViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ private async Task UpdateSelectedPackage()
}

ProgressText = $"Updating {SelectedPackage.DisplayName} to latest version...";
package.InstallLocation = SelectedPackage.Path!;
package.InstallLocation = SelectedPackage.FullPath!;
var progress = new Progress<ProgressReport>(progress =>
{
var percent = Convert.ToInt32(progress.Percentage);
Expand Down

0 comments on commit 5c7d3bc

Please sign in to comment.