In the Java directory layer, DirectoryLayer.exists returns true unconditionally when not passed a path. This is different than the other bindings, which run through the normal exists check, but which I believe will still ultimately return true. The major difference is that in Java, no read version is obtained, which can cause behavior differences in the binding tester. This adds a call to get the read version to the Java testers when processing the DIRECTORY_EXISTS instruction.
This commit is contained in:
parent
69696051a0
commit
1dbe24a6e8
|
@ -170,7 +170,10 @@ class AsyncDirectoryExtension {
|
||||||
.thenAccept(children -> inst.push(Tuple.fromItems(children).pack()));
|
.thenAccept(children -> inst.push(Tuple.fromItems(children).pack()));
|
||||||
}
|
}
|
||||||
else if(op == DirectoryOperation.DIRECTORY_EXISTS) {
|
else if(op == DirectoryOperation.DIRECTORY_EXISTS) {
|
||||||
return inst.popParam()
|
// In Java, DirectoryLayer.exists can return true without doing any reads.
|
||||||
|
// Other bindings will always do a read, so we get a read version now to be compatible with that behavior.
|
||||||
|
return inst.readTcx.readAsync(tr -> tr.getReadVersion())
|
||||||
|
.thenComposeAsync(v -> inst.popParam())
|
||||||
.thenComposeAsync(count -> DirectoryUtil.popPaths(inst, StackUtils.getInt(count)))
|
.thenComposeAsync(count -> DirectoryUtil.popPaths(inst, StackUtils.getInt(count)))
|
||||||
.thenComposeAsync(path -> {
|
.thenComposeAsync(path -> {
|
||||||
if(path.size() == 0)
|
if(path.size() == 0)
|
||||||
|
|
|
@ -160,6 +160,11 @@ class DirectoryExtension {
|
||||||
int count = StackUtils.getInt(inst.popParam().get());
|
int count = StackUtils.getInt(inst.popParam().get());
|
||||||
List<List<String>> path = DirectoryUtil.popPaths(inst, count).get();
|
List<List<String>> path = DirectoryUtil.popPaths(inst, count).get();
|
||||||
boolean exists;
|
boolean exists;
|
||||||
|
|
||||||
|
// In Java, DirectoryLayer.exists can return true without doing any reads.
|
||||||
|
// Other bindings will always do a read, so we get a read version now to be compatible with that behavior.
|
||||||
|
inst.readTcx.read(tr -> tr.getReadVersion().join());
|
||||||
|
|
||||||
if(path.size() == 0)
|
if(path.size() == 0)
|
||||||
exists = directory().exists(inst.readTcx).get();
|
exists = directory().exists(inst.readTcx).get();
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue