private async Task <DirectoryInfo> CopySourceProject() { ErrorText = null; // Can't create a project with no name if (string.IsNullOrWhiteSpace(NewProjectName)) { ErrorText = "Can't create project without a project name."; return(null); } await GetCaseSensitiveSourceName(); // Can't continue without a case-sensitive filter name if (string.IsNullOrEmpty(caseSensitiveSourceName)) { ErrorText = $"{SourceProjectDirectory.Name} solution file could not be found."; return(null); } // Photoshop convention: lower-cased folder var targetPath = $"{ParentPath}\\{NewProjectName.ToLower()}"; var targetDir = Directory.CreateDirectory(targetPath); // Don't try to replace the contents of a folder if (targetDir.GetDirectories().Length > 0 || targetDir.GetFiles().Length > 0) { ErrorText = "Can't create project. Target directory is not empty."; return(null); } await IOUtility.CopyFilesRecursivelyAsync(SourceProjectDirectory, targetDir, getNameCallback : (string name) => { var newName = name.ReplaceVariations(caseSensitiveSourceName, NewProjectName, HandleRenameConflictResolution); return(Task.FromResult(newName)); }); return(targetDir); }