Skip to content

Commit d6be6e3

Browse files
committed
[java] Read cache-path as env only
1 parent 6adfd73 commit d6be6e3

File tree

2 files changed

+4
-27
lines changed

2 files changed

+4
-27
lines changed

java/src/org/openqa/selenium/manager/BUILD.bazel

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ java_export(
2121
"//java/src/org/openqa/selenium/json",
2222
"//java/src/org/openqa/selenium/os",
2323
artifact("com.google.guava:guava"),
24-
artifact("io.ous:jtoml"),
2524
],
2625
)
2726

java/src/org/openqa/selenium/manager/SeleniumManager.java

+4-26
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919
import static org.openqa.selenium.Platform.MAC;
2020
import static org.openqa.selenium.Platform.WINDOWS;
2121

22-
import java.io.IOException;
2322
import java.io.InputStream;
24-
import java.io.Reader;
2523
import java.nio.file.Files;
2624
import java.nio.file.Path;
2725
import java.nio.file.Paths;
@@ -43,9 +41,6 @@
4341
import org.openqa.selenium.manager.SeleniumManagerOutput.Result;
4442
import org.openqa.selenium.os.CommandLine;
4543

46-
import io.ous.jtoml.JToml;
47-
import io.ous.jtoml.Toml;
48-
4944
/**
5045
* This implementation is still in beta, and may change.
5146
*
@@ -71,8 +66,6 @@ public class SeleniumManager {
7166
private static final String DEFAULT_CACHE_PATH = "~/.cache/selenium";
7267
private static final String BINARY_PATH_FORMAT = "/manager/%s/%s";
7368
private static final String HOME = "~";
74-
private static final String SE_CONFIG_FILE = "/se-config.toml";
75-
private static final String CACHE_PATH_KEY = "cache-path";
7669
private static final String CACHE_PATH_ENV = "SE_CACHE_PATH";
7770

7871
private static final String EXE = ".exe";
@@ -298,25 +291,10 @@ private Level getLogLevel() {
298291
private Path getBinaryInCache(String binaryName) {
299292
String cachePath = DEFAULT_CACHE_PATH.replace(HOME, System.getProperty("user.home"));
300293

301-
// 1. Look for cache path in config file
302-
Path configFile = Paths.get(cachePath + SE_CONFIG_FILE);
303-
if (configFile.toFile().exists()) {
304-
try (Reader reader = Files.newBufferedReader(configFile)) {
305-
Toml toml = JToml.parse(reader);
306-
Object cachePathToml = toml.get(CACHE_PATH_KEY);
307-
if (cachePathToml != null) {
308-
cachePath = cachePathToml.toString();
309-
}
310-
} catch (IOException e) {
311-
// Nothing
312-
}
313-
}
314-
else {
315-
// 2. Look for cache path as env
316-
String cachePathEnv = System.getenv(CACHE_PATH_ENV);
317-
if (cachePathEnv != null) {
318-
cachePath = cachePathEnv;
319-
}
294+
// Look for cache path as env
295+
String cachePathEnv = System.getenv(CACHE_PATH_ENV);
296+
if (cachePathEnv != null) {
297+
cachePath = cachePathEnv;
320298
}
321299

322300
return Paths.get(cachePath + String.format(BINARY_PATH_FORMAT, SELENIUM_MANAGER_VERSION, binaryName));

0 commit comments

Comments
 (0)