Skip to content

Commit c0a1968

Browse files
committed
use FileSystems.newCompositeFileSystem() api to handle delegating to real FS
1 parent 90dcc0c commit c0a1968

File tree

3 files changed

+91
-391
lines changed

3 files changed

+91
-391
lines changed

graalpython/org.graalvm.python.embedding/src/org/graalvm/python/embedding/utils/GraalPyResources.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ public static Context.Builder contextBuilder() {
259259
public static Context.Builder contextBuilder(VirtualFileSystem vfs) {
260260
return createContextBuilder().
261261
// allow access to the virtual and the host filesystem, as well as sockets
262-
allowIO(IOAccess.newBuilder().allowHostSocketAccess(true).fileSystem(vfs.impl).build()).
262+
allowIO(IOAccess.newBuilder().allowHostSocketAccess(true).fileSystem(vfs.delegatingFileSystem).build()).
263263
// The sys.executable path, a virtual path that is used by the interpreter
264264
// to discover packages
265265
option("python.Executable", vfs.impl.vfsVenvPath() + (VirtualFileSystemImpl.isWindows() ? "\\Scripts\\python.exe" : "/bin/python")).

graalpython/org.graalvm.python.embedding/src/org/graalvm/python/embedding/utils/VirtualFileSystem.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,16 @@
4040
*/
4141
package org.graalvm.python.embedding.utils;
4242

43+
import org.graalvm.polyglot.io.FileSystem;
44+
4345
import java.io.IOException;
4446
import java.nio.file.Path;
4547
import java.util.function.Predicate;
4648

4749
public final class VirtualFileSystem implements AutoCloseable {
4850

4951
final VirtualFileSystemImpl impl;
52+
final FileSystem delegatingFileSystem;
5053

5154
public static enum HostIO {
5255
NONE,
@@ -178,6 +181,7 @@ private VirtualFileSystem(Predicate<Path> extractFilter,
178181
boolean caseInsensitive) {
179182

180183
this.impl = new VirtualFileSystemImpl(extractFilter, mountPoint, allowHostIO, resourceLoadingClass, caseInsensitive);
184+
this.delegatingFileSystem = VirtualFileSystemImpl.createDelegatingFileSystem(impl);
181185
}
182186

183187
public static Builder newBuilder() {

0 commit comments

Comments
 (0)