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,6 +16,8 @@ public class FTLUtilities {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Confirms the FTL resources dir exists and contains the dat files.
|
* 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 ) {
|
public static boolean isDatsDirValid( File d ) {
|
||||||
if ( !d.exists() || !d.isDirectory() ) return false;
|
if ( !d.exists() || !d.isDirectory() ) return false;
|
||||||
|
@ -59,6 +61,10 @@ public class FTLUtilities {
|
||||||
File result = null;
|
File result = null;
|
||||||
|
|
||||||
for ( File candidate : candidates ) {
|
for ( File candidate : candidates ) {
|
||||||
|
// Resolve symlinks.
|
||||||
|
try {candidate = candidate.getCanonicalFile();}
|
||||||
|
catch ( IOException e ) {continue;}
|
||||||
|
|
||||||
if ( isDatsDirValid( candidate ) ) {
|
if ( isDatsDirValid( candidate ) ) {
|
||||||
result = candidate;
|
result = candidate;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue