From b00088a65aab708d228eeb6b9ead195bb46fe3ba Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrg=20Billeter?= Date: Fri, 20 Aug 2010 15:30:50 +0200 Subject: [PATCH] Use relative path as specified on the command-line in error messages Fixes bug 591683. --- compiler/valacompiler.vala | 6 +++++- vala/valasourcefile.vala | 17 ++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/compiler/valacompiler.vala b/compiler/valacompiler.vala index 36364bd0e..9826682f9 100644 --- a/compiler/valacompiler.vala +++ b/compiler/valacompiler.vala @@ -351,6 +351,7 @@ class Vala.Compiler { var rpath = realpath (source); if (run_output || source.has_suffix (".vala") || source.has_suffix (".gs")) { var source_file = new SourceFile (context, rpath); + source_file.relative_filename = source; if (context.profile == Profile.POSIX) { // import the Posix namespace by default (namespace of backend-specific standard library) @@ -371,7 +372,10 @@ class Vala.Compiler { context.add_source_file (source_file); } else if (source.has_suffix (".vapi") || source.has_suffix (".gir")) { - context.add_source_file (new SourceFile (context, rpath, true)); + var source_file = new SourceFile (context, rpath, true); + source_file.relative_filename = source; + + context.add_source_file (source_file); } else if (source.has_suffix (".c")) { context.add_c_source_file (rpath); has_c_files = true; diff --git a/vala/valasourcefile.vala b/vala/valasourcefile.vala index cff51b703..464c93e2d 100644 --- a/vala/valasourcefile.vala +++ b/vala/valasourcefile.vala @@ -31,7 +31,12 @@ public class Vala.SourceFile { */ public string filename { get; set; } - + public string? relative_filename { + set { + this._relative_filename = value; + } + } + /** * Specifies whether this file is a VAPI package file. */ @@ -67,7 +72,9 @@ public class Vala.SourceFile { public List current_using_directives { get; set; default = new ArrayList (); } private List nodes = new ArrayList (); - + + string? _relative_filename; + private string csource_filename = null; private string cinclude_filename = null; @@ -185,7 +192,11 @@ public class Vala.SourceFile { } public string get_relative_filename () { - return get_subdir () + Path.get_basename (filename); + if (_relative_filename != null) { + return _relative_filename; + } else { + return Path.get_basename (filename); + } } /** -- 2.47.2