Esempio n. 1
0
        /// <summary>
        /// Adds all of the specified include paths to this VCProject's list of include paths for all modules in the project
        /// </summary>
        /// <param name="NewIncludePaths">List of include paths to add</param>
        /// <param name="bAddingSystemIncludes"></param>
        public void AddIntelliSenseIncludePaths(HashSet <DirectoryReference> NewIncludePaths, bool bAddingSystemIncludes)
        {
            if (ProjectFileGenerator.OnlyGenerateIntelliSenseDataForProject == null ||
                ProjectFileGenerator.OnlyGenerateIntelliSenseDataForProject == this)
            {
                foreach (DirectoryReference CurPath in NewIncludePaths)
                {
                    if (bAddingSystemIncludes ? KnownIntelliSenseSystemIncludeSearchPaths.Add(CurPath.FullName) : KnownIntelliSenseIncludeSearchPaths.Add(CurPath.FullName))
                    {
                        // Incoming include paths are relative to the solution directory, but we need these paths to be
                        // relative to the project file's directory
                        string PathRelativeToProjectFile = NormalizeProjectPath(CurPath);

                        // Make sure that it doesn't exist already
                        bool          AlreadyExists = false;
                        List <string> SearchPaths   = bAddingSystemIncludes ? IntelliSenseSystemIncludeSearchPaths : IntelliSenseIncludeSearchPaths;
                        foreach (string ExistingPath in SearchPaths)
                        {
                            if (PathRelativeToProjectFile == ExistingPath)
                            {
                                AlreadyExists = true;
                                break;
                            }
                        }

                        if (!AlreadyExists)
                        {
                            SearchPaths.Add(PathRelativeToProjectFile);
                        }
                    }
                }
            }
        }
        /// <summary>
        /// Adds all of the specified include paths to this VCProject's list of include paths for all modules in the project
        /// </summary>
        /// <param name="NewIncludePaths">List of include paths to add</param>
        public void AddInteliiSenseIncludePaths(HashSet <string> NewIncludePaths, bool bAddingSystemIncludes)
        {
            if (ProjectFileGenerator.OnlyGenerateIntelliSenseDataForProject == null ||
                ProjectFileGenerator.OnlyGenerateIntelliSenseDataForProject == this)
            {
                foreach (string CurPath in NewIncludePaths)
                {
                    if (bAddingSystemIncludes ? KnownIntelliSenseSystemIncludeSearchPaths.Add(CurPath) : KnownIntelliSenseIncludeSearchPaths.Add(CurPath))
                    {
                        string PathRelativeToProjectFile;

                        // If the include string is an environment variable (e.g. $(DXSDK_DIR)), then we never want to
                        // give it a relative path
                        if (CurPath.StartsWith("$("))
                        {
                            PathRelativeToProjectFile = CurPath;
                        }
                        else
                        {
                            // Incoming include paths are relative to the solution directory, but we need these paths to be
                            // relative to the project file's directory
                            PathRelativeToProjectFile = NormalizeProjectPath(CurPath);
                        }

                        // Trim any trailing slash
                        PathRelativeToProjectFile = PathRelativeToProjectFile.TrimEnd('/', '\\');

                        // Make sure that it doesn't exist already
                        bool          AlreadyExists = false;
                        List <string> SearchPaths   = bAddingSystemIncludes ? IntelliSenseSystemIncludeSearchPaths : IntelliSenseIncludeSearchPaths;
                        foreach (string ExistingPath in SearchPaths)
                        {
                            if (PathRelativeToProjectFile == ExistingPath)
                            {
                                AlreadyExists = true;
                                break;
                            }
                        }

                        if (!AlreadyExists)
                        {
                            SearchPaths.Add(PathRelativeToProjectFile);
                        }
                    }
                }
            }
        }