Fixed several resource filesystem bugs

This commit is contained in:
Natty 2022-04-06 23:55:49 +02:00
parent 8313c08034
commit c675729996
No known key found for this signature in database
GPG Key ID: 40AB22FA416C7019
4 changed files with 14 additions and 5 deletions

View File

@ -1,3 +1,6 @@
## 22.0.0.0-alpha.7
* `[PlutoRuntime]` Fixed several resource filesystem bugs
## 22.0.0.0-alpha.6
* `[PlutoSpritesheet]` Added a constructor to `PartialTextureSprite` that initializes the spritesheet to `null`

View File

@ -22,7 +22,7 @@ object Versions {
const val isPrerelease = true
const val prereleaseName = "alpha"
const val prerealeaseUpdate = 6
const val prerealeaseUpdate = 7
val versionFull =
if (isPrerelease)

View File

@ -156,7 +156,14 @@ public class ResourceFileSystemProvider extends FileSystemProvider
@Override
public AsynchronousFileChannel newAsynchronousFileChannel(Path path, Set<? extends OpenOption> options, ExecutorService executor, FileAttribute<?>... attrs) throws IOException
{
return super.newAsynchronousFileChannel(path, options, executor, attrs);
if (!(path instanceof ResourcePath rp))
throw new IllegalArgumentException("Expected a path of type %s!".formatted(ResourcePath.class));
var backingPath = rp.getBackingPath();
var backingFileSystem = backingPath.getFileSystem();
var backingProvider = backingFileSystem.provider();
return backingProvider.newAsynchronousFileChannel(backingPath, options, executor, attrs);
}
@Override

View File

@ -6,6 +6,7 @@ import org.plutoengine.mod.Mod;
import javax.annotation.concurrent.ThreadSafe;
import java.io.Closeable;
import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.nio.file.ProviderNotFoundException;
import java.nio.file.spi.FileSystemProvider;
@ -30,9 +31,7 @@ public class ResourceManager implements Closeable
{
try
{
var loader = ServiceLoader.load(FileSystemProvider.class, ResourceFileSystemProvider.class.getClassLoader());
for (FileSystemProvider provider : loader)
for (FileSystemProvider provider : FileSystemProvider.installedProviders())
{
if (provider.getScheme().equals(URI_SCHEME))
{