11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/pdk/util/windows/file.rb', line 11
def get_long_pathname(path)
converted = ''
FFI::Pointer.from_string_to_wide_string(path) do |path_ptr|
buffer_size = GetLongPathNameW(path_ptr, FFI::Pointer::NULL, 0)
FFI::MemoryPointer.new(:wchar, buffer_size) do |converted_ptr|
raise 'Failed to call GetLongPathName' if GetLongPathNameW(path_ptr, converted_ptr, buffer_size) == PDK::Util::Windows::WIN32_FALSE
converted = converted_ptr.read_wide_string(buffer_size - 1)
end
end
converted
end
|