flying-circus / pyfilesystem

Automatically exported from code.google.com/p/pyfilesystem
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

basename with trailing slash returns empty string #58

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

Currently fs.path.basename("/hello/world/") returns an empty string, while 
basename("/hello/world") return "hello".

This is the same behaviour as the standard library, but is it desirable?  
Either way, we should be clear in the docs as to what happens in this case.

Original issue reported on code.google.com by rfkel...@gmail.com on 11 Mar 2011 at 12:00

GoogleCodeExporter commented 9 years ago
I think this is consistent with the path.split function. I've updated the docs, 
but feel free to elaborate.

I think I've noticed a related bug. dirname('/') should return '/' right? At 
the moment it returns an empty string.

Original comment by willmcgugan on 24 Mar 2011 at 4:39

GoogleCodeExporter commented 9 years ago
I've made dirname('/') return '/', for consistency with the os.path method. 
Tests don't break.

Original comment by willmcgugan on 7 Aug 2011 at 3:09