do
var s = opt_source.value
if s == null then
- add("in #{l.file.filename}")
+ add("in #{l.file.filename.simplify_path}")
else
# THIS IS JUST UGLY ! (but there is no replace yet)
var x = s.split_with("%f")
- s = x.join(l.file.filename)
+ s = x.join(l.file.filename.simplify_path)
x = s.split_with("%l")
s = x.join(l.line_start.to_s)
x = s.split_with("%L")
end
end
+redef class String
+ # Remove "/./", "//" and "bla/../"
+ fun simplify_path: String
+ do
+ var a = self.split_with("/")
+ var a2 = new Array[String]
+ for x in a do
+ if x == "." then continue
+ if x == "" and not a2.is_empty then continue
+ if x == ".." and not a2.is_empty then
+ a2.pop
+ continue
+ end
+ a2.push(x)
+ end
+ return a2.join("/")
+ end
+end
+
# A virtual module is used to work as an implicit main module that combine unrelated modules
# Since conflict may arrise in a virtual module (the main method for instance) conflicts are disabled
class MMVirtualModule