diff --git a/src/main/java/dan200/computercraft/api/ComputerCraftAPI.java b/src/main/java/dan200/computercraft/api/ComputerCraftAPI.java index f429ca946..2c4223725 100644 --- a/src/main/java/dan200/computercraft/api/ComputerCraftAPI.java +++ b/src/main/java/dan200/computercraft/api/ComputerCraftAPI.java @@ -98,7 +98,9 @@ public final class ComputerCraftAPI * resource folder onto a computer's file system. * * The files in this mount will be a combination of files in all mod jar, and data packs that contain - * resources with the same domain and path. + * resources with the same domain and path. For instance, ComputerCraft's resources are stored in + * "/data/computercraft/lua/rom". We construct a mount for that with + * {@code createResourceMount("computercraft", "lua/rom")}. * * @param domain The domain under which to look for resources. eg: "mymod". * @param subPath The subPath under which to look for resources. eg: "lua/myfiles". diff --git a/src/main/java/dan200/computercraft/core/filesystem/ResourceMount.java b/src/main/java/dan200/computercraft/core/filesystem/ResourceMount.java index ed21df789..afaa3dbb9 100644 --- a/src/main/java/dan200/computercraft/core/filesystem/ResourceMount.java +++ b/src/main/java/dan200/computercraft/core/filesystem/ResourceMount.java @@ -103,9 +103,13 @@ public final class ResourceMount implements IMount private void load() { boolean hasAny = false; + String existingNamespace = null; + FileEntry newRoot = new FileEntry( new ResourceLocation( namespace, subPath ) ); for( ResourceLocation file : manager.listResources( subPath, s -> true ) ) { + existingNamespace = file.getNamespace(); + if( !file.getNamespace().equals( namespace ) ) continue; String localPath = FileSystem.toLocal( file.getPath(), subPath ); @@ -114,6 +118,15 @@ public final class ResourceMount implements IMount } root = hasAny ? newRoot : null; + + if( !hasAny ) + { + ComputerCraft.log.warn("Cannot find any files under /data/{}/{} for resource mount.", namespace, subPath); + if( newRoot != null ) + { + ComputerCraft.log.warn("There are files under /data/{}/{} though. Did you get the wrong namespace?", existingNamespace, subPath); + } + } } private FileEntry get( String path )