[Win32utils-devel] File.basename issue

Berger, Daniel Daniel.Berger at qwest.com
Fri Aug 19 11:33:30 EDT 2005

Hi all,

After a recent ruby-talk thread I decided to go back and refactor the
File.basename method in win32-file.  Sure enough, after a I added some
more tests I discovered a couple minor bugs.

After reworking it, I still can't get one test to pass.  Specifically,
multiple trailing slashes.  Here's the test that shows the issue:

assert_equal("bar", File.basename("C:/foo/bar\\\\"))

Instead of "bar", I end up with "bar\" because I only call
PathRemoveBackslash() once.  I figured I could solve it with something
like this:


But that doesn't work.  I thought you could just call this until you hit
NULL, but I can't seem to make it work.  I suspect the answer is easy,
I'm just not seeing it for some reason.



More information about the win32utils-devel mailing list