Skip to content

Commit c675729

Browse files
committed
Fixed several resource filesystem bugs
1 parent 8313c08 commit c675729

4 files changed

Lines changed: 14 additions & 5 deletions

File tree

UPDATE_NOTES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 22.0.0.0-alpha.7
2+
* `[PlutoRuntime]` Fixed several resource filesystem bugs
3+
14
## 22.0.0.0-alpha.6
25
* `[PlutoSpritesheet]` Added a constructor to `PartialTextureSprite` that initializes the spritesheet to `null`
36

buildSrc/src/main/kotlin/org/plutoengine/Versions.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ object Versions {
2222

2323
const val isPrerelease = true
2424
const val prereleaseName = "alpha"
25-
const val prerealeaseUpdate = 6
25+
const val prerealeaseUpdate = 7
2626

2727
val versionFull =
2828
if (isPrerelease)

engine-core/plutoruntime/src/main/java/org/plutoengine/resource/filesystem/ResourceFileSystemProvider.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,14 @@ public FileChannel newFileChannel(Path path, Set<? extends OpenOption> options,
156156
@Override
157157
public AsynchronousFileChannel newAsynchronousFileChannel(Path path, Set<? extends OpenOption> options, ExecutorService executor, FileAttribute<?>... attrs) throws IOException
158158
{
159-
return super.newAsynchronousFileChannel(path, options, executor, attrs);
159+
if (!(path instanceof ResourcePath rp))
160+
throw new IllegalArgumentException("Expected a path of type %s!".formatted(ResourcePath.class));
161+
162+
var backingPath = rp.getBackingPath();
163+
var backingFileSystem = backingPath.getFileSystem();
164+
var backingProvider = backingFileSystem.provider();
165+
166+
return backingProvider.newAsynchronousFileChannel(backingPath, options, executor, attrs);
160167
}
161168

162169
@Override

engine-core/plutoruntime/src/main/java/org/plutoengine/resource/filesystem/ResourceManager.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import javax.annotation.concurrent.ThreadSafe;
77
import java.io.Closeable;
88
import java.io.IOException;
9+
import java.nio.file.FileSystems;
910
import java.nio.file.Path;
1011
import java.nio.file.ProviderNotFoundException;
1112
import java.nio.file.spi.FileSystemProvider;
@@ -30,9 +31,7 @@ public static ResourceFileSystemProvider provider()
3031
{
3132
try
3233
{
33-
var loader = ServiceLoader.load(FileSystemProvider.class, ResourceFileSystemProvider.class.getClassLoader());
34-
35-
for (FileSystemProvider provider : loader)
34+
for (FileSystemProvider provider : FileSystemProvider.installedProviders())
3635
{
3736
if (provider.getScheme().equals(URI_SCHEME))
3837
{

0 commit comments

Comments
 (0)