@@ -11,7 +11,7 @@ namespace PCL2.Neo.Models.Minecraft.Java
1111 /// </summary>
1212 internal class Unix
1313 {
14- #warning "该方法未经过测试 ,可能无法正常工作 Unix/SearchJava"
14+ #warning "该方法未在 Linux 上测试 ,可能无法正常工作 Unix/SearchJava"
1515 public static IEnumerable < JavaEntity > SearchJava ( ) =>
1616 FindJavaExecutablePath ( ) . Select ( it => new JavaEntity ( it ) ) ;
1717
@@ -28,11 +28,12 @@ private static HashSet<string> FindJavaExecutablePath()
2828
2929 private static bool IsValidJavaExecutable ( string filePath )
3030 {
31- if ( Directory . Exists ( filePath ) )
32- return false ;
31+ // if (Directory.Exists(filePath))
32+ // return false;
3333
34- return ! filePath . EndsWith ( ".jar" ) && ! filePath . EndsWith ( ".zip" ) && ! filePath . EndsWith ( ".so" ) &&
35- ! filePath . EndsWith ( ".dylib" ) ;
34+ // return !filePath.EndsWith(".jar") && !filePath.EndsWith(".zip") && !filePath.EndsWith(".so") &&
35+ // !filePath.EndsWith(".dylib");
36+ return File . Exists ( filePath ) ;
3637 }
3738
3839 private static void SearchDirectoryForJava ( string basePath , HashSet < string > foundJava )
@@ -41,8 +42,7 @@ private static void SearchDirectoryForJava(string basePath, HashSet<string> foun
4142 {
4243 var binDirs = Directory . EnumerateDirectories ( basePath , "bin" , SearchOption . AllDirectories ) ;
4344 binDirs
44- . SelectMany ( binDir =>
45- Directory . EnumerateDirectories ( binDir , "java" , SearchOption . TopDirectoryOnly ) )
45+ . SelectMany ( binDir => Directory . EnumerateFiles ( binDir , "java" , SearchOption . TopDirectoryOnly ) )
4646 . Where ( IsValidJavaExecutable )
4747 . ToList ( ) . ForEach ( it => foundJava . Add ( it ) ) ;
4848 }
0 commit comments