Skip to content

Commit f50529f

Browse files
author
Paul van Brenk
committed
Ensure when we add a folder we use a trailing slash
1 parent 11e245f commit f50529f

File tree

4 files changed

+13
-16
lines changed

4 files changed

+13
-16
lines changed

Common/Product/SharedProject/CommonUtils.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,8 @@ public static string EnsureEndSeparator(string path)
550550
{
551551
if (string.IsNullOrEmpty(path))
552552
{
553-
return string.Empty;
553+
Debug.Fail("what??");
554+
return path;
554555
}
555556
else if (!HasEndSeparator(path))
556557
{

Nodejs/Product/Nodejs/SharedProject/CommonProjectNode.DiskMerger.cs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public async Task<bool> ContinueMergeAsync(bool hierarchyCreated)
5959
private async Task<bool> ContinueMergeAsyncWorker((string Name, HierarchyNode Parent) dir, bool hierarchyCreated)
6060
{
6161
var wasExpanded = hierarchyCreated ? dir.Parent.GetIsExpanded() : false;
62-
var missingChildren = new HashSet<HierarchyNode>(dir.Parent.AllChildren);
62+
var missingOnDisk = new HashSet<HierarchyNode>(dir.Parent.AllChildren);
6363

6464
var thread = this.project.Site.GetUIThread();
6565

@@ -92,15 +92,9 @@ private async Task<bool> ContinueMergeAsyncWorker((string Name, HierarchyNode Pa
9292
this.project.CreateSymLinkWatcher(curDir);
9393
}
9494

95-
var existing = this.project.FindNodeByFullPath(curDir);
96-
if (existing == null)
97-
{
98-
existing = this.project.AddAllFilesFolder(dir.Parent, curDir + Path.DirectorySeparatorChar, hierarchyCreated);
99-
}
100-
else
101-
{
102-
missingChildren.Remove(existing);
103-
}
95+
var existing = this.project.AddAllFilesFolder(dir.Parent, curDir, hierarchyCreated);
96+
missingOnDisk.Remove(existing);
97+
10498
this.remainingDirs.Push((curDir, existing));
10599
}
106100
}
@@ -136,7 +130,7 @@ private async Task<bool> ContinueMergeAsyncWorker((string Name, HierarchyNode Pa
136130
}
137131
else
138132
{
139-
missingChildren.Remove(existing);
133+
missingOnDisk.Remove(existing);
140134
}
141135
}
142136

@@ -156,7 +150,7 @@ private async Task<bool> ContinueMergeAsyncWorker((string Name, HierarchyNode Pa
156150
}
157151

158152
// remove the excluded children which are no longer there
159-
this.RemoveMissingChildren(missingChildren);
153+
this.RemoveMissingChildren(missingOnDisk);
160154

161155
if (hierarchyCreated)
162156
{

Nodejs/Product/Nodejs/SharedProject/CommonProjectNode.FileSystemChange.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ private async Task ChildCreatedAsync(HierarchyNode child)
184184
this.project.CreateSymLinkWatcher(this.path);
185185
}
186186

187-
var folderNode = this.project.AddAllFilesFolder(parent, this.path + Path.DirectorySeparatorChar);
187+
var folderNode = this.project.AddAllFilesFolder(parent, this.path);
188188
var folderNodeWasExpanded = folderNode.GetIsExpanded();
189189

190190
// then add the folder nodes

Nodejs/Product/Nodejs/SharedProject/CommonProjectNode.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -693,10 +693,12 @@ private HierarchyNode AddAllFilesFile(HierarchyNode curParent, string file)
693693
/// </summary>
694694
private HierarchyNode AddAllFilesFolder(HierarchyNode curParent, string curDir, bool hierarchyCreated = true)
695695
{
696-
var folderNode = FindNodeByFullPath(curDir);
696+
var safePath = CommonUtils.EnsureEndSeparator(curDir);
697+
698+
var folderNode = FindNodeByFullPath(safePath);
697699
if (folderNode == null)
698700
{
699-
folderNode = CreateFolderNode(new AllFilesProjectElement(curDir, "Folder", this));
701+
folderNode = CreateFolderNode(new AllFilesProjectElement(safePath, "Folder", this));
700702
AddAllFilesNode(curParent, folderNode);
701703

702704
if (hierarchyCreated)

0 commit comments

Comments
 (0)