@@ -23,6 +23,9 @@ public static DiffInfo findIt()
2323 if (!diffInfo .isEmpty ())
2424 { return diffInfo ; }
2525 }
26+ DiffInfo diffInfo = getDiffInfoWindows (DiffInfo .getProgramFilesPaths (), f -> new File (f ).exists ());
27+ if (!diffInfo .isEmpty ())
28+ { return diffInfo ; }
2629 return DiffInfo .getNull ();
2730 }
2831 public static DiffInfo getDiffInfoMac (String userHome , Function1 <String , Boolean > fileExists )
@@ -31,28 +34,26 @@ public static DiffInfo getDiffInfoMac(String userHome, Function1<String, Boolean
3134 "IntelliJ IDEA Community Edition" );
3235 Queryable <String > applications = as ("/Applications" , userHome + "/Applications" );
3336 String postfix = ".app/Contents/MacOS/idea" ;
34- return getDiffInfo (fileExists , applications , locations , postfix );
37+ return getDiffInfo (fileExists , applications , locations , postfix , "/" );
3538 }
3639 public static DiffInfo getDiffInfoLinux (String userHome , Function1 <String , Boolean > fileExists )
3740 {
3841 Queryable <String > locations = as ("intellij-idea-ultimate" , "intellij-idea-community-edition" );
3942 Queryable <String > applications = as (userHome + "/.local/share/JetBrains/Toolbox/apps" );
4043 String postfix = "/bin/idea.sh" ;
41- return getDiffInfo (fileExists , applications , locations , postfix );
42- }
43- private static DiffInfo getDiffInfo (Function1 <String , Boolean > fileExists , Queryable <String > locations ,
44- Queryable <String > applications , String postfix )
45- {
46- Queryable <String > paths = locations .selectMany (a -> applications .select (l -> a + "/" + l + postfix ));
47- String matching = paths .first (fileExists );
48- return new DiffInfo (matching , "diff %s %s" , GenericDiffReporter .TEXT_FILE_EXTENSIONS );
44+ return getDiffInfo (fileExists , applications , locations , postfix , "/" );
4945 }
5046 public static DiffInfo getDiffInfoWindows (String [] programFiles , Function1 <String , Boolean > fileExists ) {
5147 Queryable <String > applications = as ("IntelliJ IDEA Ultimate" , "IntelliJ IDEA" , "IntelliJ IDEA Community" ,
5248 "IntelliJ IDEA Community Edition" );
5349 Queryable <String > locations = Queryable .as (programFiles );
5450 String postfix = "\\ bin\\ idea64.exe" ;
55- Queryable <String > paths = locations .selectMany (l -> applications .select (a -> l + "\\ " + a + postfix ));
51+ return getDiffInfo (fileExists , locations , applications , postfix , "\\ " );
52+ }
53+ private static DiffInfo getDiffInfo (Function1 <String , Boolean > fileExists , Queryable <String > locations ,
54+ Queryable <String > applications , String postfix , String pathSeparator )
55+ {
56+ Queryable <String > paths = locations .selectMany (l -> applications .select (a -> l + pathSeparator + a + postfix ));
5657 String matching = paths .first (fileExists );
5758 return new DiffInfo (matching , "diff %s %s" , GenericDiffReporter .TEXT_FILE_EXTENSIONS );
5859 }
0 commit comments