Permalink
Browse files

Replace backslashes in paths "correctly" on UNIX

The FirefoxOptions attempts to standardise paths to use
forward slashes since these are most portable. The
existing code works on Windows, but not a UNIX-like OS,
which is a pity.

The fix here will obviously fail if given a UNIX path
with a valid backslash in it, but we'll assume that
never happens.
  • Loading branch information...
shs96c committed Mar 30, 2017
1 parent 48ce781 commit ed3e946a9ad04299c2a61f4b75ebb60abb76c9c8
Showing with 1 addition and 7 deletions.
  1. +1 −7 java/client/src/org/openqa/selenium/firefox/FirefoxOptions.java
@@ -27,7 +27,6 @@
import static org.openqa.selenium.remote.CapabilityType.VERSION;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Joiner;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.gson.JsonArray;
@@ -197,12 +196,7 @@ public FirefoxOptions setBinary(Path path) {
}
private String toForwardSlashes(Path path) {
Path root = path.getRoot();
if (root != null) {
return root.toString().replace('\\', '/') + Joiner.on("/").join(path);
} else {
return Joiner.on("/").join(path);
}
return Preconditions.checkNotNull(path).toString().replace('\\', '/');
}
public FirefoxOptions setBinary(String path) {

0 comments on commit ed3e946

Please sign in to comment.