[valadoc] libvaladoc: Avoid multiple imports



commit 5a00916143eb6531f8fd848727d70b87edb21f60
Author: Florian Brosch <flo brosch gmail com>
Date:   Mon Nov 19 00:59:08 2012 +0100

    libvaladoc: Avoid multiple imports

 src/libvaladoc/api/tree.vala |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/libvaladoc/api/tree.vala b/src/libvaladoc/api/tree.vala
index 55cfe6e..cc662d1 100644
--- a/src/libvaladoc/api/tree.vala
+++ b/src/libvaladoc/api/tree.vala
@@ -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);
 				}
 			}
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]