Skip to content

Commit

Permalink
Fixed several resource filesystem bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
AMNatty committed Apr 6, 2022
1 parent 8313c08 commit c675729
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
3 changes: 3 additions & 0 deletions UPDATE_NOTES.md
Original file line number Diff line number Diff line change
@@ -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`

Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/org/plutoengine/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,14 @@ public FileChannel newFileChannel(Path path, Set<? extends OpenOption> options,
@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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
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;
Expand All @@ -30,9 +31,7 @@ public static ResourceFileSystemProvider provider()
{
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))
{
Expand Down

0 comments on commit c675729

Please sign in to comment.