1 package com.tapina.robe.swi.clib.stdio; 2 3 import com.tapina.robe.runtime.Environment; 4 import com.tapina.robe.runtime.FilenameUtils; 5 import com.tapina.robe.swi.clib.Stub; 6 7 import java.io.File; 8 9 /*** 10 * This function attempts to remove the file whose name is contained in a1. 11 * This is equivalent to *Delete or OS_File 6 . If the file is open, the function will almost certainly fail. 12 * Returns: Zero if the file is removed. 13 */ 14 public class Remove extends Stub { 15 public void executeStub(Environment environment) { 16 final int[] R = environment.getCpu().R; 17 final String filename = environment.getMemoryMap().getString0(R[0]); 18 final File file = new File(FilenameUtils.acornToNative(filename)); 19 R[0] = file.delete()? 0 : -1; 20 } 21 }