未验证 提交 a9c960da 编写于 作者: A Andrew Casey 提交者: GitHub

Merge pull request #28623 from amcasey/FilePath

Use FilePath in VisualStudioWorkspaceImpl.AddDocumentToProjectItems
......@@ -554,15 +554,15 @@ private void AddDocumentCore(DocumentInfo info, SourceText initialText, bool isA
if (IsWebsite(project))
{
AddDocumentToFolder(hostProject, project, info.Id, SpecializedCollections.SingletonEnumerable(AppCodeFolderName), info.Name, info.SourceCodeKind, initialText, isAdditionalDocument: isAdditionalDocument);
AddDocumentToFolder(hostProject, project, info.Id, SpecializedCollections.SingletonEnumerable(AppCodeFolderName), info.Name, info.SourceCodeKind, initialText, isAdditionalDocument: isAdditionalDocument, filePath: info.FilePath);
}
else if (folders.Any())
{
AddDocumentToFolder(hostProject, project, info.Id, folders, info.Name, info.SourceCodeKind, initialText, isAdditionalDocument: isAdditionalDocument);
AddDocumentToFolder(hostProject, project, info.Id, folders, info.Name, info.SourceCodeKind, initialText, isAdditionalDocument: isAdditionalDocument, filePath: info.FilePath);
}
else
{
AddDocumentToProject(hostProject, project, info.Id, info.Name, info.SourceCodeKind, initialText, isAdditionalDocument: isAdditionalDocument);
AddDocumentToProject(hostProject, project, info.Id, info.Name, info.SourceCodeKind, initialText, isAdditionalDocument: isAdditionalDocument, filePath: info.FilePath);
}
var undoManager = TryGetUndoManager();
......@@ -644,7 +644,8 @@ protected override void AddExistingDocument(DocumentId documentId, string filePa
string filePath = null,
bool isAdditionalDocument = false)
{
if (!project.TryGetFullPath(out var folderPath))
string folderPath = null;
if (filePath == null && !project.TryGetFullPath(out folderPath))
{
// TODO(cyrusn): Throw an appropriate exception here.
throw new Exception(ServicesVSResources.Could_not_find_location_of_folder_on_disk);
......@@ -665,7 +666,9 @@ protected override void AddExistingDocument(DocumentId documentId, string filePa
bool isAdditionalDocument = false)
{
var folder = project.FindOrCreateFolder(folders);
if (!folder.TryGetFullPath(out var folderPath))
string folderPath = null;
if (filePath == null && !folder.TryGetFullPath(out folderPath))
{
// TODO(cyrusn): Throw an appropriate exception here.
throw new Exception(ServicesVSResources.Could_not_find_location_of_folder_on_disk);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册