Just another update

This commit is contained in:
Ingy döt Net 2015-02-20 00:35:01 -05:00
parent a25938f123
commit 00a190b0a6
6591 changed files with 94363 additions and 23227 deletions

View file

@ -0,0 +1,18 @@
// Gets the first filesystem root. On most systems this will be / or c:\
def fsRoot = File.listRoots().first()
// Create our list of files (including directories)
def files = [
new File("input.txt"),
new File(fsRoot, "input.txt"),
new File("docs"),
new File(fsRoot, "docs")
]
/*
We use it.directory to determine whether each file is a regular file or directory. If it is a directory, we delete
it with deleteDir(), otherwise we just use delete().
*/
files.each{
it.directory ? it.deleteDir() : it.delete()
}

View file

@ -0,0 +1,4 @@
FileTools:-Remove("input.txt");
FileTools:-RemoveDirectory("docs");
FileTools:-Remove("/input.txt");
FileTools:-RemoveDirectory("/docs");

View file

@ -0,0 +1,4 @@
(delete-file "input.txt")
(delete-file "/input.txt")
(remove-dir "docs")
(remove-dir "/docs")

View file

@ -2,17 +2,14 @@ import java.util._
import java.io.File
object FileDeleteTest extends App {
def deleteFile(filename: String) = {
new File(filename).delete();
}
def deleteFile(filename: String) = { new File(filename).delete() }
def test(typ: String, filename: String) = {
System.out.println("The following " + typ + " called " + filename +
(if (deleteFile(filename)) " was deleted." else " could not be deleted."))
}
test("file", "input.txt");
test("file", File.separatorChar + "input.txt");
test("directory", "docs");
test("directory", File.separatorChar + "docs" + File.separatorChar);
test("file", "input.txt")
test("file", File.separatorChar + "input.txt")
test("directory", "docs")
test("directory", File.separatorChar + "docs" + File.separatorChar)
}

View file

@ -0,0 +1,10 @@
$ include "seed7_05.s7i";
include "osfiles.s7i";
const proc: main is func
begin
removeFile("input.txt");
removeFile("/input.txt");
removeTree("docs");
removeTree("/docs");
end func;