Rre: ruby, cygwin and paths

How to convert a 8.3 dos paths to its fully expanded version. For
example, how to translate:
C:\CYGWIN\HOME\MYFULL~1\MONROE~9.ALT
to
/cygdrive/c/cygwin/home/My Full Name/Monroe-Tyson.alt
Any solution out there?
Guillaume.

require ‘Win32API’

def get_long_win32_filename(short_name)
max_path = 1024
long_name = " " * max_path
lfn_size = Win32API.new(“kernel32”, “GetLongPathName”, [‘P’,‘P’,‘L’],
‘L’).call(short_name, long_name, max_path)
return (1…max_path).include?(lfn_size) ? long_name[0…lfn_size-1] :
short_name
end

short_name = ‘C:\progra~1\frozen~1\frozen~1.exe’
puts “#{get_long_win32_filename(short_name)}” # => C:\Program
Files\Frozen-Bubble\frozen-bubble.exe

cheers,
prs

Thanx.

Guillaume.

···

Le 3 avr. 04, à 08:49, anon luker a écrit :

How to convert a 8.3 dos paths to its fully expanded version. For
example, how to translate:
C:\CYGWIN\HOME\MYFULL~1\MONROE~9.ALT
to
/cygdrive/c/cygwin/home/My Full Name/Monroe-Tyson.alt
Any solution out there?
Guillaume.

require ‘Win32API’

def get_long_win32_filename(short_name)
max_path = 1024
long_name = " " * max_path
lfn_size = Win32API.new(“kernel32”, “GetLongPathName”, [‘P’,‘P’,‘L’],
‘L’).call(short_name, long_name, max_path)
return (1…max_path).include?(lfn_size) ? long_name[0…lfn_size-1] :
short_name
end

short_name = ‘C:\progra~1\frozen~1\frozen~1.exe’
puts “#{get_long_win32_filename(short_name)}” # => C:\Program
Files\Frozen-Bubble\frozen-bubble.exe

cheers,
prs