diff --git a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/plugins/FilePlugin.java b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/plugins/FilePlugin.java index 42a9d0ccf..8e438f837 100644 --- a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/plugins/FilePlugin.java +++ b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/plugins/FilePlugin.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2017-2021 Software Architecture Group, Hasso Plattner Institute + * Copyright (c) 2021 Oracle and/or its affiliates * * Licensed under the MIT License. */ @@ -696,4 +697,19 @@ private static void writeToOutputStream(final OutputStream outputStream, final b } } } + + @GenerateNodeFactory + @SqueakPrimitive(names = "primitiveHasFileAccess") + protected abstract static class PrimHasFileAccessNode extends AbstractPrimitiveNode { + @Specialization + @TruffleBoundary + protected final boolean hasFileAccess(@SuppressWarnings("unused") final Object receiver) { + try { + getContext().env.getCurrentWorkingDirectory(); + return BooleanObject.TRUE; + } catch (final SecurityException e) { + return BooleanObject.FALSE; + } + } + } }