You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[WIP, ADDTESTS] Add new options for formatting relative include paths
Setting PathFormat=PathMode.Absolute_FromParentDirWithFile in combination with setting FromParentDirWithFile to a filename that exists "toward" the root of your source directory tree allows us to make include paths relative to the nearest parent folder containing the specified file. This is something we do with our projects in a global property sheet. MSBuild has the awesome built-in property function "GetDirectoryNameOfFileAbove", which lets you use a known file (e.g. we have an empty "build.root" in the root of our source tree) to do the same thing as this feature. Using this functionality lets you specify things like additional include/link dirs in a common way that works everywhere so you don't have to spam a lot of relative paths in your project settings or include directives. In other words, with that set, any file can include any header by specifying its path relative to the root of our source. To "correctly" handle system includes and includes that are in the same directory as the file you're working on (that we want to leave path-less), IgnoreFileRelative was changed from a boolean setting to an enum, where Never/Always should be the same as false/true and InSameDirectory/InSameOrSubDirectory provide some more control over which directives to skip. I'm not entirely happy with the IgnoreFileRelative setting, I don't think it's very clear what it's supposed to do (in fact, I don't think I knew what it did before working on this), so perhaps this could be improved somehow in the future.
[DisplayName("Filename in parent directory for absolute include paths")]
31
+
[Description("The Absolute_FromParentDirWithFile mode will look for this file in parent directories and make include paths absolute from its location.")]
0 commit comments