lib/poi2csv.rb in poi2csv-0.0.1 vs lib/poi2csv.rb in poi2csv-0.0.2

- old
+ new

@@ -1,10 +1,13 @@ +require 'shellwords' require "poi2csv/version" module Poi2csv def self.to_csv(input_file_path, output_folder_path, separator=nil, formating_convention=nil) - `java -cp #{classpath} ToCSV #{input_file_path} #{output_folder_path} #{separator} #{formating_convention}` + args = [input_file_path, output_folder_path, separator, formating_convention].reject { |v| v.nil? } + args = args.map { |v| Shellwords.escape(v) } + `java -cp #{classpath} ToCSV #{args * ' '}` end def self.classpath @_classpath ||= File.expand_path(File.join(File.dirname(__FILE__),'*')) + File::PATH_SEPARATOR + File.expand_path(File.join(File.dirname(__FILE__),'..', 'classes')) end