Skip to content

Commit 4796234

Browse files
committed
fix: scaning reposities does not work when both global and workspace default clone dir are not configured (#1848)
Signed-off-by: leo <longshuang@msn.cn>
1 parent 04a1d92 commit 4796234

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

src/ViewModels/ScanRepositories.cs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.ComponentModel.DataAnnotations;
43
using System.IO;
54
using System.Threading.Tasks;
65

@@ -25,7 +24,6 @@ public List<Models.ScanDir> ScanDirs
2524
get;
2625
}
2726

28-
[Required(ErrorMessage = "Scan directory is required!!!")]
2927
public Models.ScanDir Selected
3028
{
3129
get => _selected;
@@ -53,11 +51,26 @@ public ScanRepositories()
5351

5452
public override async Task<bool> Sure()
5553
{
56-
var selectedDir = _useCustomDir ? _customDir : _selected?.Path;
57-
if (string.IsNullOrEmpty(selectedDir))
54+
string selectedDir;
55+
if (_useCustomDir)
5856
{
59-
App.RaiseException(null, "Missing root directory to scan!");
60-
return false;
57+
if (string.IsNullOrEmpty(_customDir))
58+
{
59+
App.RaiseException(null, "Missing root directory to scan!");
60+
return false;
61+
}
62+
63+
selectedDir = _customDir;
64+
}
65+
else
66+
{
67+
if (_selected == null || string.IsNullOrEmpty(_selected.Path))
68+
{
69+
App.RaiseException(null, "Missing root directory to scan!");
70+
return false;
71+
}
72+
73+
selectedDir = _selected.Path;
6174
}
6275

6376
if (!Directory.Exists(selectedDir))

0 commit comments

Comments
 (0)