Skip to content

Commit d362032

Browse files
committed
F find MeldMerge in 2 different locations #22
1 parent 71d7ce9 commit d362032

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

approvaltests/src/main/java/org/approvaltests/reporters/DiffInfo.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
import java.util.HashSet;
55
import java.util.List;
66

7+
import com.spun.util.ArrayUtils;
8+
import java.util.Objects;
9+
710
public class DiffInfo
811
{
912
public String diffProgram;
@@ -48,10 +51,23 @@ public static String getFirstWorking(String path, String[] paths, String ifNotFo
4851
}
4952
public static String[] getProgramFilesPaths()
5053
{
51-
HashSet<String> paths = new HashSet<String>();
54+
HashSet<String> paths = new HashSet<>();
5255
paths.add(System.getenv("ProgramFiles(x86)"));
5356
paths.add(System.getenv("ProgramFiles"));
5457
paths.add(System.getenv("ProgramW6432"));
55-
return paths.stream().filter(p -> p != null).toArray(s -> new String[s]);
58+
return paths.stream().filter(Objects::nonNull).toArray(String[]::new);
59+
}
60+
public static class One
61+
{
62+
public static String of(String pathOne, String... paths)
63+
{
64+
final String[] all = ArrayUtils.combine(new String[]{pathOne}, paths);
65+
for (String path : all)
66+
{
67+
if (new File(path).exists())
68+
{ return path; }
69+
}
70+
return pathOne;
71+
}
5672
}
5773
}

approvaltests/src/main/java/org/approvaltests/reporters/DiffPrograms.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import java.util.List;
88

9+
import org.approvaltests.reporters.DiffInfo.One;
910
import org.approvaltests.reporters.intellij.IntelliJPathResolver;
1011

1112
import com.spun.util.ArrayUtils;
@@ -64,6 +65,6 @@ public static class All
6465
public static class Linux
6566
{
6667
public static DiffInfo DIFF_MERGE = new DiffInfo("/usr/bin/diffmerge", "--nosplash %s %s ", TEXT);
67-
public static DiffInfo MELD_MERGE = new DiffInfo("/usr/bin/meld", "%s %s ", TEXT);
68+
public static DiffInfo MELD_MERGE = new DiffInfo(One.of("/usr/bin/meld", "/usr/local/bin/meld"), "%s %s ", TEXT);
6869
}
6970
}

0 commit comments

Comments
 (0)