Hi,
2013/4/11 Daniel Berger <djberg96 at gmail.com>>
> Can someone provide me with a working example of PathRemoveBacklash and
FFI? I cannot get it to work right. It doesn''t seem to modify its
receiver.
>
> # path_remove.rb
> require ''ffi''
>
> class Windows
> extend FFI::Library
>
> ffi_lib :shlwapi
>
> attach_function :PathRemoveBackslashA, [:buffer_out], :string
>
> def initialize(path)
> p path
> p PathRemoveBackslashA(path)
> p path
> end
> end
>
> Windows.new("C:\\")
> # end path_remove.rb
>
I guess "C:\\" is a special case.
Here is a working code:
===require ''ffi''
class Windows
extend FFI::Library
ffi_lib :shlwapi
attach_function :PathRemoveBackslashA, [:buffer_out], :string
def initialize(path)
p path
while(PathRemoveBackslashA(path)=="");end
p path.strip
end
end
Windows.new("C:/work/test\\\\")
====
And, the old reference is
http://rubyforge.org/pipermail/win32utils-devel/2005-August/000423.html
>
> I thought I''d asked this before at some point but I can''t
find any reference to it, so my apologies if I''m repeating myself.
>
> Regards,
>
> Dan
>
Regards,
Park Heesob