feature: add a button to scan repositories under default clone dir (#427)

This commit is contained in:
leo 2024-08-30 16:14:10 +08:00
parent aab14784fc
commit 0d676fa3fb
No known key found for this signature in database
9 changed files with 162 additions and 3 deletions

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using Avalonia.Collections;
using Avalonia.Controls;
@ -114,6 +115,17 @@ namespace SourceGit.ViewModels
Native.OS.OpenTerminal(null);
}
public void ScanDefaultCloneDir()
{
var defaultCloneDir = Preference.Instance.GitDefaultCloneDir;
if (string.IsNullOrEmpty(defaultCloneDir))
App.RaiseException(PopupHost.Active.GetId(), "The default clone dir haven't been configured!");
else if (!Directory.Exists(defaultCloneDir))
App.RaiseException(PopupHost.Active.GetId(), $"The default clone dir '{defaultCloneDir}' is not exists!");
else if (PopupHost.CanCreatePopup())
PopupHost.ShowAndStartPopup(new ScanRepositories(defaultCloneDir));
}
public void ClearSearchFilter()
{
SearchFilter = string.Empty;