- if is_windows then
- var l = length - 1 # Index of the last char
- while l > 0 and (self.chars[l] == '/' or chars[l] == '\\') do l -= 1 # remove all trailing `/`
- if l == 0 then return "/"
- var pos = chars.last_index_of_from('/', l)
- pos = pos.max(last_index_of_from('\\', l))
- if pos >= 0 then
- n = substring(pos+1, l-pos)
- end
- else
- 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 = chars.last_index_of_from('/', l)
- if pos >= 0 then
- n = substring(pos+1, l-pos)
- end
+ if is_windows then n = n.replace("\\", "/")
+
+ 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 = chars.last_index_of_from('/', l)
+ if pos >= 0 then
+ n = substring(pos+1, l-pos)