Skip to content

Commit c5c11ac

Browse files
committed
Move TargetDirectory handling
1 parent 6620581 commit c5c11ac

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/Files.App/ViewModels/Dialogs/CloneRepoDialogViewModel.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright (c) Files Community
22
// Licensed under the MIT License.
33

4-
using LibGit2Sharp;
54
using System.IO;
65
using System.Windows.Input;
76

@@ -24,7 +23,7 @@ public bool CanCloneRepo
2423
}
2524
}
2625

27-
private string repoUrl;
26+
private string repoUrl = string.Empty;
2827
public string RepoUrl
2928
{
3029
get => repoUrl;
@@ -35,25 +34,25 @@ public string RepoUrl
3534
}
3635
}
3736

38-
private string repoName;
37+
private string repoName = string.Empty;
3938
public string RepoName
4039
{
4140
get => repoName;
4241
set => SetProperty(ref repoName, value);
4342

4443
}
4544

46-
private string targetDirectory;
47-
public string TargetDirectory
45+
private string workingDirectory = string.Empty;
46+
public string WorkingDirectory
4847
{
49-
get => targetDirectory;
50-
set => SetProperty(ref targetDirectory, value);
48+
get => workingDirectory;
49+
set => SetProperty(ref workingDirectory, value);
5150

5251
}
5352

5453
public ICommand CloneRepoCommand { get; private set; }
5554

56-
public CloneRepoDialogViewModel(string repoUrl, string workingDirectory)
55+
public CloneRepoDialogViewModel(string repoUrl, string directory)
5756
{
5857
var repoInfo = GitHelpers.GetRepoInfo(repoUrl);
5958

@@ -68,13 +67,14 @@ public CloneRepoDialogViewModel(string repoUrl, string workingDirectory)
6867
RepoName = string.Empty;
6968
}
7069

71-
TargetDirectory = Path.Combine(workingDirectory, RepoName);
70+
WorkingDirectory = directory;
7271

7372
CloneRepoCommand = new AsyncRelayCommand(DoCloneRepo);
7473
}
7574

7675
private async Task DoCloneRepo()
7776
{
77+
var targetDirectory = Path.Combine(workingDirectory, RepoName);
7878
await GitHelpers.CloneRepoAsync(RepoUrl, repoName, targetDirectory);
7979
}
8080
}

0 commit comments

Comments
 (0)