[vala/switch-to-gir: 25/47] vapigen: Fix marking gir metadata as source.



commit 203ef58d6c58e8e9e5567b2f19bd50a566d4d3c5
Author: Luca Bruno <lucabru src gnome org>
Date:   Thu Dec 23 14:31:19 2010 +0100

    vapigen: Fix marking gir metadata as source.

 vapigen/valavapigen.vala |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/vapigen/valavapigen.vala b/vapigen/valavapigen.vala
index 573a3a7..3247aa3 100644
--- a/vapigen/valavapigen.vala
+++ b/vapigen/valavapigen.vala
@@ -122,7 +122,7 @@ class Vala.VAPIGen : Object {
 		if (context.report.get_errors () > 0) {
 			return quit ();
 		}
-		
+
 		foreach (string source in sources) {
 			if (FileUtils.test (source, FileTest.EXISTS)) {
 				context.add_source_file (new SourceFile (context, SourceFileType.PACKAGE, source));
@@ -169,10 +169,16 @@ class Vala.VAPIGen : Object {
 			}
 			if (file.filename in sources) {
 				file.file_type = SourceFileType.SOURCE;
-			} else if (file.filename.has_suffix (".metadata")) {
-				string gir_filename = "%s.gir".printf (file.filename.substring (0, file.filename.length - ".metadata".length));
-				if (gir_filename in sources) {
-					file.file_type = SourceFileType.SOURCE;
+				if (file.filename.has_suffix (".gir")) {
+					// mark relative metadata as source
+					string? metadata_filename = context.get_metadata_path (file.filename);
+					if (metadata_filename != null) {
+						foreach (SourceFile metadata_file in context.get_source_files ()) {
+							if (metadata_file.filename == metadata_filename) {
+								metadata_file.file_type = SourceFileType.SOURCE;
+							}
+						}
+					}
 				}
 			}
 		}



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