I should use File.separator for directory separation in path

pull/856/head
Rui Gu 8 years ago
parent b4978ed9e0
commit 6417459808

@ -50,7 +50,7 @@ public class ClusterRunner {
ArrayList<RedisRunner.RedisProcess> processes = new ArrayList<>(); ArrayList<RedisRunner.RedisProcess> processes = new ArrayList<>();
for (RedisRunner runner : nodes.keySet()) { for (RedisRunner runner : nodes.keySet()) {
List<String> options = getClusterConfig(runner); List<String> options = getClusterConfig(runner);
String confFile = runner.dir() + File.separatorChar + nodes.get(runner) + ".conf"; String confFile = runner.dir() + File.separator + nodes.get(runner) + ".conf";
System.out.println("WRITING CONFIG: for " + nodes.get(runner)); System.out.println("WRITING CONFIG: for " + nodes.get(runner));
try (PrintWriter printer = new PrintWriter(new FileWriter(confFile))) { try (PrintWriter printer = new PrintWriter(new FileWriter(confFile))) {
options.stream().forEach((line) -> { options.stream().forEach((line) -> {

@ -272,7 +272,7 @@ public class RedisRunner {
public RedisProcess runAndCheck() throws IOException, InterruptedException, FailedToStartRedisException { public RedisProcess runAndCheck() throws IOException, InterruptedException, FailedToStartRedisException {
List<String> args = new ArrayList(options.values()); List<String> args = new ArrayList(options.values());
if (sentinelFile != null && sentinelFile.length() > 0) { if (sentinelFile != null && sentinelFile.length() > 0) {
String confFile = defaultDir + File.pathSeparator + sentinelFile; String confFile = defaultDir + File.separator + sentinelFile;
try (PrintWriter printer = new PrintWriter(new FileWriter(confFile))) { try (PrintWriter printer = new PrintWriter(new FileWriter(confFile))) {
args.stream().forEach((arg) -> { args.stream().forEach((arg) -> {
if (arg.contains("--")) { if (arg.contains("--")) {
@ -845,7 +845,7 @@ public class RedisRunner {
} }
public boolean deleteSentinelFile() { public boolean deleteSentinelFile() {
File f = new File(defaultDir + File.pathSeparator + sentinelFile); File f = new File(defaultDir + File.separator + sentinelFile);
if (f.exists()) { if (f.exists()) {
System.out.println("REDIS RUNNER: Deleting sentinel config file " + f.getAbsolutePath()); System.out.println("REDIS RUNNER: Deleting sentinel config file " + f.getAbsolutePath());
return f.delete(); return f.delete();
@ -863,7 +863,7 @@ public class RedisRunner {
} }
private void makeRandomDefaultDir() { private void makeRandomDefaultDir() {
File f = new File(RedissonRuntimeEnvironment.tempDir + File.pathSeparator + UUID.randomUUID()); File f = new File(RedissonRuntimeEnvironment.tempDir + File.separator + UUID.randomUUID());
if (f.exists()) { if (f.exists()) {
makeRandomDefaultDir(); makeRandomDefaultDir();
} else { } else {

Loading…
Cancel
Save