diff --git a/rtl/java/Files.java b/rtl/java/Files.java
index 5fe0074ca6293714b95895c070a78113ee14fcbe..5ccfa25acacc8822278fce3aa1f2039837e6fd59 100644 (file)
--- a/rtl/java/Files.java
+++ b/rtl/java/Files.java
try
{
- filepath = File.createTempFile(RandomString(8), "tmp");
+ filepath = File.createTempFile(SYSTEM.STRING(name), "tmp");
fileregpath = new File(SYSTEM.STRING(name));
filedesc = new RandomAccessFile(filepath, "rw");
}
file = new RECORD0();
file.path = filepath;
- file.regpath = fileregpath;
+ file.regpath = fileregpath.getAbsoluteFile();
file.desc = filedesc;
return file;
}
public static void Register(RECORD0 f)
+ throws
+ IOException
{
- f.path.renameTo(f.regpath);
+ java.nio.file.Files.move(
+ java.nio.file.Paths.get(f.path.getPath()),
+ java.nio.file.Paths.get(f.regpath.getPath()),
+ java.nio.file.StandardCopyOption.REPLACE_EXISTING
+ );
f.path = f.regpath;
}
public static void Write(RECORD1 r[], int r$, byte x)
{
- SYSTEM.TRAP(-3);
+ RECORD1 rider = r[r$];
+ RandomAccessFile desc = rider.base.desc;
+
+ try
+ {
+ rider.base.SetActive(rider);
+ desc.write(x);
+ rider.position += 1;
+ }
+ catch(IOException e)
+ {
+ rider.res[0] = 1;
+ rider.eof[0] = true;
+ }
}
public static void WriteInt(RECORD1 R[], int R$, short x)