lib/win_gui/app.rb in win_gui-0.2.18 vs lib/win_gui/app.rb in win_gui-0.2.19

- old
+ new

@@ -54,12 +54,13 @@ # :raise:: raise this exception instead of returning nil if launched app window not found # def launch(opts) app_path = opts.delete(:path) || opts.delete(:app_path) dir_path = opts.delete(:dir) || opts.delete(:cd) + args = opts.delete(:args) || opts.delete(:argv) - launch_app app_path, dir_path + launch_app app_path, dir_path, args defaults = {timeout: LAUNCH_TIMEOUT, raise: WinGui::Errors::InitError.new("Unable to launch App with #{opts.inspect}")} find(defaults.merge opts) end @@ -68,13 +69,14 @@ def cygwin? @cygwin_flag ||= RUBY_PLATFORM =~ /cygwin/ end - def launch_app(app_path, dir_path) + def launch_app(app_path, dir_path, args = nil) app = cygwin? ? app_path.to_s : app_path.to_s.gsub(/\//, "\\") command = cygwin? ? "cmd /c start `cygpath -w #{app}`" : "start #{app}" + command += " #{args}" if args if dir_path dir = cygwin? ? dir_path.to_s : dir_path.to_s.gsub(/\//, "\\") unless File.exists?(dir) && File.directory?(dir) raise WinGui::Errors::InitError, "Unable to change to #{dir_path.inspect}" \ No newline at end of file