Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 5450302

Browse files
committed
Restore DefaultClonePath if Path is cleared
If Path is cleared, restore the DefaultClonePath on next selection.
1 parent 0e885b2 commit 5450302

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

src/GitHub.App/ViewModels/Dialog/Clone/RepositoryCloneViewModel.cs

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -149,24 +149,31 @@ void UpdatePath(IRepositoryModel repository)
149149
}
150150
}
151151

152-
static string GetBasePath(string path, string owner)
152+
string GetBasePath(string path, string owner)
153153
{
154-
if (owner != null)
154+
if (string.IsNullOrEmpty(path))
155155
{
156-
var dir = path;
157-
for (var i = 0; i < 2; i++)
156+
return service.DefaultClonePath;
157+
}
158+
159+
if (string.IsNullOrEmpty(owner))
160+
{
161+
return path;
162+
}
163+
164+
var dir = path;
165+
for (var i = 0; i < 2; i++)
166+
{
167+
if (string.IsNullOrEmpty(dir))
168+
{
169+
break;
170+
}
171+
172+
var name = System.IO.Path.GetFileName(dir);
173+
dir = System.IO.Path.GetDirectoryName(dir);
174+
if (name == owner)
158175
{
159-
if (string.IsNullOrEmpty(dir))
160-
{
161-
break;
162-
}
163-
164-
var name = System.IO.Path.GetFileName(dir);
165-
dir = System.IO.Path.GetDirectoryName(dir);
166-
if (name == owner)
167-
{
168-
return dir;
169-
}
176+
return dir;
170177
}
171178
}
172179

0 commit comments

Comments
 (0)