module RobustExcelOle::Cygwin

Public Class Methods

cygpath(options, path) click to toggle source

@private

# File lib/robust_excel_ole/cygwin.rb, line 16
def cygpath(options, path) 
  absolute = shortname = false
  func = nil
  options.delete(" \t-").chars do |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
  end
  raise 'first argument must contain -u or -w' if func.nil?

  func = absolute ? func[0] : func[1]
  buf = "\0" * 300
  raise 'cannot convert path name' if func.Call(path, buf) == -1

  buf.delete!("\0")
  buf
end

Private Instance Methods

cygpath(options, path) click to toggle source

@private

# File lib/robust_excel_ole/cygwin.rb, line 16
def cygpath(options, path) 
  absolute = shortname = false
  func = nil
  options.delete(" \t-").chars do |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
  end
  raise 'first argument must contain -u or -w' if func.nil?

  func = absolute ? func[0] : func[1]
  buf = "\0" * 300
  raise 'cannot convert path name' if func.Call(path, buf) == -1

  buf.delete!("\0")
  buf
end