Beispiel #1
0
        public bool GenerateIndex()
        {
            IndexMaker indexMaker = new IndexMaker();

            foreach (HelpSource current in this.helpSources)
            {
                current.PopulateIndex(indexMaker);
            }

            var  paths      = GetIndexesPathPrefixes().Select(bp => Path.Combine(bp, "monodoc.index"));
            bool successful = false;

            foreach (var path in paths)
            {
                try {
                    indexMaker.Save(path);
                    successful = true;
                    if (RootTree.IsUnix)
                    {
                        RootTree.chmod(path, 420);
                    }
                } catch (UnauthorizedAccessException) {
                }
            }
            if (!successful)
            {
                Console.WriteLine("You don't have permissions to write on any of [" + string.Join(", ", paths) + "]");
                return(false);
            }

            Console.WriteLine("Documentation index updated");
            return(true);
        }