module Chef::ReservedNames::Win32::API::CommandLineHelper
Public Instance Methods
command_line_to_argv_w_helper(args)
click to toggle source
It takes the supplied string and splits it into an array.
# File lib/chef/win32/api/command_line_helper.rb, line 64 def command_line_to_argv_w_helper(args) arguments_list = [] argv = args.to_wstring result = get_command_line argc = FFI::MemoryPointer.new(:int) # Parses a Unicode command line string # It is return an array of pointers to the command line arguments. # Along with a count of such arguments result = command_line_to_argv_w(argv, argc) str_ptr = result.read_pointer offset = 0 number_of_agrs = argc.read_int number_of_agrs.times do new_str_pointer = str_ptr.+(offset) argument = new_str_pointer.read_wstring arguments_list << argument offset = offset + argument.length * 2 + 2 end local_free(result) arguments_list end