1
Vote

Adding a folder when the folder already exists differs from C#

description

Select a folder, Project->New Folder, type in a folder name that exists on disk but not in the project system.
 
In MPFProj this reports an error that the folder already exists.
 
In C# this adds the existing folder.
 
The difference here is that MPFProj always immediately adds the folder including attempting to create the directory. The C# project system waits until the call to SetEditLabel to actually do the work of creating the directory and doesn't care if it already exists.

comments

dinov wrote Dec 8, 2011 at 12:14 AM

KlausGuetter wrote Jan 13, 2012 at 7:57 AM

The proposed fix has a problem with subordinate folders: the VirtualNodeName is set wrong in this case which leads to the problem that files added to the new subordinate folder A\B\C end up in projectdir\C.

To fix, replace the line
this.VirtualFolderName = filename;
by
this.VirtualFolderName = Path.Combine(Parent.VirtualFolderName, filename);
in FinishFolderAdd

wrote Feb 14, 2013 at 3:58 AM