fix: bring back ability to automatically quote desired capabilities on win by root-intruder · Pull Request #1454 · appium/java-client

Change list

  • Bring back automatic quote escaping for desired capabilities command line arguments on windows

Types of changes

What types of changes are you proposing/introducing to Java client?
Put an x in the boxes that apply

  • No changes in production code.
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Details

Escaped quotes are necessary for starting appium from the command line on windows systems (see http://appium.io/docs/en/writing-running-appium/default-capabilities-arg/).

This capability to automatically quote on windows systems was completely removed with commit #1337. Since #1336 discovered a special case where automatic quote escaping on windows was not possible. That means, that windows users now need to manually escape the JSON such as:

DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability("\"platformName\"", "\"Android\"");

AppiumServiceBuilder builder = new AppiumServiceBuilder();
builder.withCapabilities(cap);

For a normal user this additional escape "\"platformName\"" is cumbersome and not intuitive at all. It also makes it hard to write java code running on windows and unix/linux systems.

From my understanding, the escaping should be done automatically by the java-client. However, this is a breaking change, thus I propose a switch to be able to enable quote escaping. If desired, I could also implement quote escaping as default behaviour with a switch to disable it. But I think this decision should be on your side.

Cheers!