Merge origin/master to prepare the integration
authorJean Privat <jean@pryen.org>
Wed, 26 Mar 2014 00:46:23 +0000 (20:46 -0400)
committerJean Privat <jean@pryen.org>
Wed, 26 Mar 2014 00:59:11 +0000 (20:59 -0400)
Conflicts:
lib/standard/file.nit

13 files changed:
1  2 
lib/standard/file.nit
lib/standard/stream.nit
lib/standard/string.nit
src/global_compiler.nit
src/metrics/generate_hierarchies.nit
src/metrics/model_hyperdoc.nit
src/model/model.nit
src/naive_interpreter.nit
src/network_debugger.nit
src/nitdbg_client.nit
src/nitdoc.nit
src/nitx.nit
src/separate_compiler.nit

@@@ -263,24 -240,12 +263,24 @@@ redef class Strin
        end
  
        # Extract the basename of a path and remove the extension
 +      #
 +      #     assert "/path/to/a_file.ext".basename(".ext")         == "a_file"
 +      #     assert "path/to/a_file.ext".basename(".ext")          == "a_file"
 +      #     assert "path/to".basename(".ext")                     == "to"
 +      #     assert "path/to/".basename(".ext")                    == "to"
 +      #     assert "path".basename("")                        == "path"
 +      #     assert "/path".basename("")                       == "path"
 +      #     assert "/".basename("")                           == "/"
 +      #     assert "".basename("")                            == ""
        fun basename(ext: String): String
        do
-               var l = _length - 1 # Index of the last char
 -              var pos = last_index_of_from('/', length - 1)
++              var l = length - 1 # Index of the last char
 +              while l > 0 and self.chars[l] == '/' do l -= 1 # remove all trailing `/`
 +              if l == 0 then return "/"
 +              var pos = last_index_of_from('/', l)
                var n = self
                if pos >= 0 then
 -                      n = substring_from(pos+1)
 +                      n = substring(pos+1, l-pos)
                end
                return n.strip_extension(ext)
        end
        #     assert "".dirname                            == "."
        fun dirname: String
        do
-               var l = _length - 1 # Index of the last char
+               var l = length - 1 # Index of the last char
 -              if l > 0 and self.chars[l] == '/' then l -= 1 # remove trailing `/`
 +              while l > 0 and self.chars[l] == '/' do l -= 1 # remove all trailing `/`
                var pos = last_index_of_from('/', l)
                if pos > 0 then
                        return substring(0, pos)
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 3b06cf5,c80e8c3..4b01ecd
mode 100644,100755..100644
diff --cc src/nitdoc.nit
Simple merge
diff --cc src/nitx.nit
Simple merge
Simple merge