Reading files!

- File.close()
- File.open()
- File.read()
- file.readBytes()

And a few other little methods. Still lots more work to do, but it's a
start.
This commit is contained in:
Bob Nystrom
2015-09-30 21:13:36 -07:00
parent bacbd85543
commit b7ed774da3
32 changed files with 475 additions and 44 deletions
+2 -7
View File
@@ -1,7 +1,7 @@
import "io" for File
import "scheduler" for Scheduler
System.print(File.size("test/io/file/size.wren")) // expect: 401
System.print(File.size("test/io/file/size.wren")) // expect: 270
// Runs asynchronously.
Scheduler.add {
@@ -10,9 +10,4 @@ Scheduler.add {
System.print(File.size("test/io/file/size.wren"))
// expect: async
// expect: 401
var error = Fiber.new {
System.print(File.size("nonexistent"))
}.try()
System.print(error) // expect: no such file or directory
// expect: 270