On 19/05/05, Austin Ziegler <halostatue / gmail.com> wrote:
> On 5/19/05, Berger, Daniel <Daniel.Berger / qwest.com> wrote:
> > require "Win32API"
> >
> > PathStripToRoot = Win32API.new("shlwapi","PathStripToRoot","P","L")
> > path = 'C:\foo\bar'
> >
> > rv = PathStripToRoot.call(path)
> > puts "RV: #{rv}"
> > puts "Path is [#{path}]"
> >
> > With that I end up with:
> >
> > RV: 1
> > Path is [C:\ oo bar]
> >
> > Do I need to encode and/or decode 'path' somehow first?
> 
> All PathStripToRoot is doing is putting \000 after C:\. Do an #inspect.
> 
> I'm not sure what the right answer is in this case.

I can't test it because I'm on linux, but wouldn't
rv = PathStripToRoot.call(path)
path = path.split(0.chr, 2)[0]
puts "RV: #{rv}"
puts "Path is [#{path}]"

work?

best regards,

Brian
-- 
http://ruby.brian-schroeder.de/

Stringed instrument chords: http://chordlist.brian-schroeder.de/