14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/wrap_excel/cygwin.rb', line 14
def cygpath(options, path)
absolute = shortname = false
func = nil
options.delete(" \t-").chars {|opt|
case opt
when ?u
func = [@conv_to_full_posix_path, @conv_to_posix_path]
when ?w
func = [@conv_to_full_win32_path, @conv_to_win32_path]
when ?a
absolute = true
when ?s
shortname = true
end
}
raise "first argument must contain -u or -w" if func.nil?
func = absolute ? func[0] : func[1]
buf = "\0" * 300
if func.Call(path, buf) == -1
raise "cannot convert path name"
end
buf.delete!("\0")
buf
end
|