From: Jürg Billeter Date: Fri, 20 Aug 2010 13:30:50 +0000 (+0200) Subject: Use relative path as specified on the command-line in error messages X-Git-Tag: 0.9.8~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b00088a65aab708d228eeb6b9ead195bb46fe3ba;p=thirdparty%2Fvala.git Use relative path as specified on the command-line in error messages Fixes bug 591683. --- 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); + } } /**