[vala/0.10: 16/38] Use relative path as specified on the command-line in error messages
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.10: 16/38] Use relative path as specified on the command-line in error messages
- Date: Sat, 4 Sep 2010 15:02:46 +0000 (UTC)
commit b00088a65aab708d228eeb6b9ead195bb46fe3ba
Author: Jürg Billeter <j bitron ch>
Date: Fri Aug 20 15:30:50 2010 +0200
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 36364bd..9826682 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 cff51b7..464c93e 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<UsingDirective> current_using_directives { get; set; default = new ArrayList<UsingDirective> (); }
private List<CodeNode> nodes = new ArrayList<CodeNode> ();
-
+
+ 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);
+ }
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]