Method: Appium::Driver.absolute_app_path

Defined in:
lib/appium_lib/driver.rb

.absolute_app_path(opts) ⇒ String

Deprecated

Converts app_path to an absolute path.

opts is the full options hash (caps and appium_lib). If server_url is set then the app path is used as is.

if app isn’t set then an error is raised.

Returns:

  • (String)

    APP_PATH as an absolute path

Raises:


402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
# File 'lib/appium_lib/driver.rb', line 402

def self.absolute_app_path(opts)
  raise ArgumentError, 'opts must be a hash' unless opts.is_a? Hash

  caps = opts[:caps] || opts['caps'] || {}
  app_path = get_cap(caps, 'app')
  raise ArgumentError, 'absolute_app_path invoked and app is not set!' if app_path.nil? || app_path.empty?
  # Sauce storage API. http://saucelabs.com/docs/rest#storage
  return app_path if app_path.start_with? 'sauce-storage:'
  return app_path if app_path =~ URI::DEFAULT_PARSER.make_regexp # public URL for Sauce

  ::Appium::Logger.warn('[Deprecation] Converting the path to absolute path will be removed. ' \
                        'Please specify the full path which can be accessible from the appium server')

  absolute_app_path = File.expand_path app_path
  if File.exist? absolute_app_path
    absolute_app_path
  else
    ::Appium::Logger.info("Use #{app_path}")
    app_path
  end
end