Fix error when ModsDiscoverer visits a non existent mods dir.

Closes cpw/modlauncher#30

Signed-off-by: cpw <cpw+github@weeksfamily.ca>
This commit is contained in:
cpw 2019-07-20 19:37:54 -04:00
parent 186d91c03f
commit 9d82d822db
No known key found for this signature in database
GPG key ID: 8EB3DF749553B1B7

View file

@ -28,6 +28,7 @@ import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.zip.ZipFile;
@ -35,6 +36,10 @@ public class ModDirTransformerDiscoverer implements ITransformerDiscoveryService
@Override
public List<Path> candidates(final Path gameDirectory) {
final Path modsDir = gameDirectory.resolve(FMLPaths.MODSDIR.relative());
if (!Files.exists(modsDir)) {
// Skip if the mods dir doesn't exist yet.
return Collections.emptyList();
}
List<Path> paths = new ArrayList<>();
try {
Files.createDirectories(modsDir);