@@ -58,6 +58,16 @@ static unsigned menuFilterLevels[MAX_MENU_FILTER_LEVEL] = {
5858static char * lockedProject = NULL ;
5959static char * lockedProjectRoot = NULL ;
6060
61+ static bool fileIsUnderIncludePaths (char * fileName ) {
62+ for (StringList * dir = options .includeDirs ; dir != NULL ; dir = dir -> next ) {
63+ int len = strlen (dir -> string );
64+ if (strncmp (fileName , dir -> string , len ) == 0
65+ && (fileName [len ] == '/' || fileName [len ] == '\0' )) {
66+ return true;
67+ }
68+ }
69+ return false;
70+ }
6171
6272/* *********************************************************************** */
6373
@@ -1794,8 +1804,10 @@ static void handleProject() {
17941804 if (lockedProject != NULL ) {
17951805 /* Server is locked - check if this file belongs to the locked project */
17961806 if (lockedProjectRoot != NULL ) {
1797- /* Auto-detected project - check file path against project root */
1798- if (strncmp (fileName , lockedProjectRoot , strlen (lockedProjectRoot )) == 0 ) {
1807+ /* Auto-detected project - file is in scope if under project root
1808+ * or under a configured include path */
1809+ if (strncmp (fileName , lockedProjectRoot , strlen (lockedProjectRoot )) == 0
1810+ || fileIsUnderIncludePaths (fileName )) {
17991811 ppcGenRecord (PPC_SET_INFO , lockedProject );
18001812 } else {
18011813 ppcGenRecord (PPC_PROJECT_MISMATCH , lockedProject );
0 commit comments