Splitting PATH-values fails on Windows

Good evening.

A user of one of my programs reports a problem, where I try to find a
helper-application in one of the PATH-directories. The issue is
Windows-specific and I do not own a Windows-machine to verify.

So I wrote the small Ruby-script in the attachment, with just one
function to separate and output the list of directories from the current

For the time, it looks like my way to split the variable-value produces
mostly garbage and in consequence, the program tries to read the
contents of directories like “\some_directory\sub-directory”, i.e. the
drive-letter appears to be missing. However, File::PATH_SEPARATOR is
used and the MS-specific path- and directory-separators appear to be
honoured alright.

I cannot believe, that I have made a big mistake, but would like you to
tell me. The routine in the original program is about the same as in the
attached script.

Thank you in advance.

The program is on SourceForge, but for the time being, I would recommend
its use only to users on systems other than Windows:

Have a nice weed-end, all.

You script seems to works for me on Windows XP (apart from the fact that
nil is returned for invalid pathdirs, of which there were apparently two
in my PATH).

Maybe you’re handling paths with spaces wrong somewhere? I don’t know
what else could cause any issues.

Thank you Bartosz.

This is a big relief. And you are right. The nil-values are handled by a
call to compact!() in the original program, where I do not need to
extract actual path-names.

I will just further elaborate the error-handling and just exclude the
call to the external application altogether in case that nothing works
as expected.