views:

1173

answers:

3

In the Solution Explorer when working with C++ projects there is the standard filters of Header Files, Resource Files, and Source Files. What I'm wanting to accomplish is essentially Filters by folder.


Lets say the structure of the files was like this:

  • ../Folder1/Source1.cpp
  • ../Folder1/Header1.h
  • ../Folder1/Source2.cpp
  • ../Folder1/Header2.h
  • ../AnotherFolder/Source1.cpp
  • ../AnotherFolder/Header1.h
  • ../AnotherFolder/Source2.cpp
  • ../AnotherFolder/Header2.h
  • ../SomeOtherSource.cpp

In the Solution Explorer, it would look like:

  • Header Files/Header1.h
  • Header Files/Header1.h
  • Header Files/Header2.h
  • Header Files/Header2.h
  • Source Files/SomeOtherSource.cpp
  • Source Files/Source1.cpp
  • Source Files/Source1.cpp
  • Source Files/Source2.cpp
  • Source Files/Source2.cpp

And I would like to have it look like this:

  • Header Files/AnotherFolder/Header1.h
  • Header Files/AnotherFolder/Header2.h
  • Header Files/Folder1/Header1.h
  • Header Files/Folder1/Header2.h
  • Source Files/AnotherFolder/Source1.cpp
  • Source Files/AnotherFolder/Source2.cpp
  • Source Files/Folder1/Source1.cpp
  • Source Files/Folder1/Source2.cpp
  • Source Files/SomeOtherSource.cpp


How would this be accomplished?

+1  A: 

You are free to manually create folders yourself and move the files around. I agree this is a much more convenient way to arrange files but AFAIK there is no way to make VS do this automatically.

shoosh
But, when you create a filter it doesn't create a folder. So, when moving files into it, you would have to also make the folder, and move the file into that folder as well.
kitchen
+1  A: 

You can create the Visual Studio Plugin to do this. I am not sure how you can access "Solution Explorer" programatically.

Vinay
+1  A: 

show all files?

zeus