Skip to content

Commit 865a86a

Browse files
committed
Fixes: Projects in user folder after projects in ProgramFiles bug #817
1 parent 532240d commit 865a86a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

External/Plugins/ProjectManager/Controls/NewProjectDialog.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,9 @@ public NewProjectDialog()
300300

301301
ListViewGroup group = null;
302302
List<String> templateDirs = ProjectPaths.GetAllProjectDirs();
303+
templateDirs.Sort(CompareFolderNames);
304+
ListViewItem lastItem = null;
305+
303306
foreach (string templateDir in templateDirs)
304307
{
305308
// skip hidden folders (read: version control)
@@ -322,11 +325,20 @@ public NewProjectDialog()
322325
}
323326
item.Group = group;
324327
}
328+
329+
if (lastItem != null && lastItem.Text == item.Text) // remove duplicates (keep last)
330+
projectListView.Items.Remove(lastItem);
331+
lastItem = item;
325332
projectListView.Items.Add(item);
326333
}
327334
this.Load += new EventHandler(NewProjectDialog_Load);
328335
}
329336

337+
int CompareFolderNames(string pathA, string pathB)
338+
{
339+
return Path.GetFileName(pathA).CompareTo(Path.GetFileName(pathB));
340+
}
341+
330342
void NewProjectDialog_Load(object sender, EventArgs e)
331343
{
332344
if (!String.IsNullOrEmpty(lastTemplate))

0 commit comments

Comments
 (0)