11// Copyright (c) Files Community
22// Licensed under the MIT License.
33
4- using LibGit2Sharp ;
54using System . IO ;
65using 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