8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/pdk/util/windows/file.rb', line 8
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|
if GetLongPathNameW(path_ptr, converted_ptr, buffer_size) == PDK::Util::Windows::WIN32_FALSE
raise _('Failed to call GetLongPathName')
end
converted = converted_ptr.read_wide_string(buffer_size - 1)
end
end
converted
end
|