nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
957426f
)
lib/file: remove all trailing / on String::dirname
author
Jean Privat
<jean@pryen.org>
Fri, 14 Mar 2014 20:22:19 +0000
(16:22 -0400)
committer
Jean Privat
<jean@pryen.org>
Fri, 14 Mar 2014 20:22:19 +0000
(16:22 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>
lib/standard/file.nit
patch
|
blob
|
history
diff --git
a/lib/standard/file.nit
b/lib/standard/file.nit
index
4ba20a0
..
b23e86c
100644
(file)
--- a/
lib/standard/file.nit
+++ b/
lib/standard/file.nit
@@
-263,7
+263,7
@@
redef class String
fun dirname: String
do
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)