Fixed unresolved symlinks when locating FTL resources
This commit is contained in:
parent
738c05e853
commit
12f4db94f9
1 changed files with 8 additions and 2 deletions
|
@ -16,11 +16,13 @@ public class FTLUtilities {
|
|||
|
||||
/**
|
||||
* Confirms the FTL resources dir exists and contains the dat files.
|
||||
*
|
||||
* Note: Do d.getCanonicalFile() to resolve any symlinks first!
|
||||
*/
|
||||
public static boolean isDatsDirValid( File d ) {
|
||||
if ( !d.exists() || !d.isDirectory() ) return false;
|
||||
if ( !new File(d, "data.dat").exists() ) return false;
|
||||
if ( !new File(d, "resource.dat").exists() ) return false;
|
||||
if ( !new File( d, "data.dat" ).exists() ) return false;
|
||||
if ( !new File( d, "resource.dat" ).exists() ) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -59,6 +61,10 @@ public class FTLUtilities {
|
|||
File result = null;
|
||||
|
||||
for ( File candidate : candidates ) {
|
||||
// Resolve symlinks.
|
||||
try {candidate = candidate.getCanonicalFile();}
|
||||
catch ( IOException e ) {continue;}
|
||||
|
||||
if ( isDatsDirValid( candidate ) ) {
|
||||
result = candidate;
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue