Closed ghost closed 4 years ago
We found another anomaly related to java.io.File. It seems that through reflection, the field File.separatorChar is returned as the value 0. Here is what is expected:
Ordinary Java (for example on the Windows platform):
In CheerpJ (\0\ is the Prolog string escape for value character code 0):
This could be related to the issue here: https://github.com/leaningtech/cheerpj-appletrunner/issues/24
On the other hand we could find a fix for the missing f.createNewFile()
. We just use new FileOutputStream()
, and it will also create files for us in the file tree /files/
. As a result we have Prolog settings for our Prolog interpreter immediately without further ado.
This is due to the system settings which are cleverly set by CheerpJ, and make everything work for us without further fixes. Settings can now be used in our Prolog interpreter applet. An example setting, that is stored in this file. is the command line history. Great job!
As we understand /files/
is mapped to IndexedDB somehow. This also means that the end-user can clear it at any time through some browser menu item. This is no loss, this can also happen for our settings on the other platforms, since they can be also manually removed there.
f.createNewFile()
and the separatorChar
issue should be fixed in CheerpJ Applet Runner 6.7. f.delete()
is indeed not supported at this time.
File deletion is supported in CheerpJ Applet Runner 8.7
We were expecting that '/files/' accepts file and directory operations. But they seem to only work partially. It seems that new FileOutputStream() does created an entry, but createNewFile() doesn't.
Also directory listing list() works but delete() doesn't work. I was checking the operations on the instances of the Java class java.io.File.