Fix a couple of issues with FileSystemMounts

- Only generate resource pack mounts if the desired directory exists.
 - Allow mounting files, as well as directories (fixes #90).

As always, also a wee bit of cleanup to some of the surrounding code.
This commit is contained in:
SquidDev
2018-12-24 15:22:19 +00:00
parent 2032e7a83a
commit 5b48a0fa5f
9 changed files with 165 additions and 57 deletions
@@ -100,6 +100,7 @@ import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.util.*;
import java.util.function.Function;
import java.util.zip.ZipEntry;
@@ -955,7 +956,7 @@ public class ComputerCraft
{
// Mount a resource pack from a jar
FileSystem fs = FileSystems.newFileSystem( resourcePack.toPath(), ComputerCraft.class.getClassLoader() );
mounts.add( new FileSystemMount( fs, subPath ) );
if( Files.exists( fs.getPath( subPath ) ) ) mounts.add( new FileSystemMount( fs, subPath ) );
}
else
{