]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
libvaladoc: Avoid multiple imports
authorFlorian Brosch <flo.brosch@gmail.com>
Sun, 18 Nov 2012 23:59:08 +0000 (00:59 +0100)
committerFlorian Brosch <flo.brosch@gmail.com>
Mon, 19 Nov 2012 00:56:05 +0000 (01:56 +0100)
src/libvaladoc/api/tree.vala

index 55cfe6ec3e86f4b74eb1100bfaea6390c355323d..cc662d13e8c252802c8f685a7bbe91c8482dcf52 100644 (file)
@@ -274,14 +274,21 @@ public class Valadoc.Api.Tree {
         * @param import_directories List of directories where to find the files
         */
        public void import_documentation (DocumentationImporter[] importers, string[] packages, string[] import_directories) {
+               HashSet<string> processed = new HashSet<string> ();
                foreach (string pkg_name in packages) {
                        bool imported = false;
                        foreach (DocumentationImporter importer in importers) {
                                string? path = get_file_path ("%s.%s".printf (pkg_name, importer.file_extension), import_directories);
+                               if (path == null) {
+                                       continue;
+                               }
+
+                               path = realpath (path);
+                               imported = true;
 
-                               if (path != null) {
+                               if (!processed.contains (path)) {
                                        importer.process (path);
-                                       imported = true;
+                                       processed.add (path);
                                }
                        }