Index: pylib/gyp/MSVSNew.py |
diff --git a/pylib/gyp/MSVSNew.py b/pylib/gyp/MSVSNew.py |
index 667e531c99ff530d83b71ee061fd05f1830e95fa..845dcb0639d7568efafd74ed20b16d275e13cc6c 100644 |
--- a/pylib/gyp/MSVSNew.py |
+++ b/pylib/gyp/MSVSNew.py |
@@ -325,14 +325,15 @@ class MSVSSolution: |
f.write('\tEndGlobalSection\r\n') |
# Folder mappings |
- # TODO(rspangler): Should omit this section if there are no folders |
- f.write('\tGlobalSection(NestedProjects) = preSolution\r\n') |
- for e in all_entries: |
- if not isinstance(e, MSVSFolder): |
- continue # Does not apply to projects, only folders |
- for subentry in e.entries: |
- f.write('\t\t%s = %s\r\n' % (subentry.get_guid(), e.get_guid())) |
- f.write('\tEndGlobalSection\r\n') |
+ # Omit this section if there are no folders |
+ if any([e.entries for e in all_entries if isinstance(e, MSVSFolder)]): |
+ f.write('\tGlobalSection(NestedProjects) = preSolution\r\n') |
+ for e in all_entries: |
+ if not isinstance(e, MSVSFolder): |
+ continue # Does not apply to projects, only folders |
+ for subentry in e.entries: |
+ f.write('\t\t%s = %s\r\n' % (subentry.get_guid(), e.get_guid())) |
+ f.write('\tEndGlobalSection\r\n') |
f.write('EndGlobal\r\n') |