Commit Graph

37 Commits

Author SHA1 Message Date
5edaf69915 Update.
Some checks failed
WrenCI / linux (push) Failing after 34s
WrenCI / mac (push) Has been cancelled
WrenCI / windows (push) Has been cancelled
2026-01-26 12:29:25 +01:00
a830238d11 Update. 2026-01-25 13:09:28 +01:00
4de99d477f Update. 2026-01-25 10:54:09 +01:00
Josh Goebel
8227330eb6
Improve file/directory utils (#84) 2021-05-01 15:58:17 -07:00
underscorediscovery
fe186d2ea1 0.3.0; skip tests that were previously failing on windows + mac until that can be fixed
We don't need to block 0.3.0 on this
2020-05-28 13:12:08 -07:00
underscorediscovery
f5f08bbbf5 0.3.0: it appears stat on a directory has no size on windows 2020-02-16 15:52:08 -08:00
Bob Nystrom
6002cc4d65 Add Stdin.isTerminal. 2016-05-21 12:51:11 -07:00
Bob Nystrom
5d98d20175 Add Stdin.isRaw. 2016-05-20 15:19:18 -07:00
Bob Nystrom
500dd41ccd Add Stdin.readByte(). 2016-05-20 11:50:14 -07:00
Bob Nystrom
1e4b9e5175 File.realPath().
Not tested yet, because we can't create symlinks from Wren and I don't
want to check symlinks into the repo, but it seems to do the right
thing.
2016-02-27 15:53:02 -08:00
Bob Nystrom
60162575ee More file system checking functions:
- Stat#isFile
- Stat#isDirectory
- Directory.exists()
- File.exists()
2016-02-21 12:23:33 -08:00
Bob Nystrom
b331915259 Add stat instance method to File. 2016-02-21 10:18:45 -08:00
Bob Nystrom
8e90e3577b More file IO!
Can now create, delete, and write to files.
2016-02-20 09:23:42 -08:00
Bob Nystrom
79558d95e5 Move File.stat() -> Stat.path().
Thanks, Michel!
2016-02-07 09:56:16 -08:00
Bob Nystrom
f9d1e9954a Make File.stat() directory test less file system sensitive. 2016-01-05 07:32:51 -08:00
Bob Nystrom
94208647ab Test File.stat() on a directory. 2016-01-01 10:05:31 -08:00
Bob Nystrom
5cd8a06fa0 File.stat(). 2016-01-01 09:58:44 -08:00
Bob Nystrom
b054526df8 Add an optional offset to File.readBytes(). 2015-12-30 08:13:19 -08:00
Bob Nystrom
ed6fad6153 Get rid of fiber for finalizers.
Instead, finalizers just get access to the foreign object's raw bytes.
This is deliberately limiting, since it discourages the user from
interacting with the VM in the middle of a GC.
2015-12-28 08:06:29 -08:00
Bob Nystrom
0ac793d4f8 Add Directory.list() to io. 2015-12-24 10:12:12 -08:00
Bob Nystrom
78655c68b0 Simple string interpolation.
This allows "%(...)" inside a string literal to interpolate the
stringified result of an expression.

It doesn't support custom interpolators or format strings, but we can
consider extending that later.
2015-11-11 07:55:48 -08:00
Bob Nystrom
d431c2eaa8 Start sketching in support for reading from stdin. 2015-10-16 21:05:24 -07:00
Bob Nystrom
b7ed774da3 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.
2015-09-30 21:13:36 -07:00
Bob Nystrom
dc527c8d86 Add "io" module with beginnings of a File class. 2015-09-16 07:34:49 -07:00
Bob Nystrom
58e4d26648 "IO" -> "System".
Get rid of the separate opt-in IO class and replace it with a core
System class.

- Remove wren_io.c, wren_io.h, and io.wren.
- Remove the flags that disable it.
- Remove the overloads for print() with different arity. (It was an
  experiment, but I don't think it's that useful.)
- Remove IO.read(). That will reappear using libuv in the CLI at some
  point.
- Remove IO.time. Doesn't seem to have been used.
- Update all of the tests, docs, etc.

I'm sorry for all the breakage this causes, but I think "System" is a
better name for this class (it makes it natural to add things like
"System.gc()") and frees up "IO" for referring to the CLI's IO module.
2015-09-15 07:46:09 -07:00
Bob Nystrom
2e83f056c1 No more default constructors.
Fixes #296.
2015-09-01 08:16:04 -07:00
Bob Nystrom
bc822cd4c7 Merge branch 'master' into constructor-methods 2015-07-19 12:49:23 -07:00
Bob Nystrom
d91c06d18b Tweak IO library a bit:
- Reword some docs.
- Make IO.printAll() public.
- Require () on read.
2015-07-18 14:09:00 -07:00
Bob Nystrom
5fb6186d7d Make constructors just methods.
* Eliminate "new" reserved word.
* Allow "this" before a method definition to define a constructor.
* Only create a default constructor for classes that don't define one.
2015-07-10 09:18:22 -07:00
Michel Martens
542a783cb4 Change IO.read to return null on EOF 2015-03-07 09:10:18 +00:00
Bob Nystrom
1d9445d9bc Tests for IO.read(). 2015-01-11 21:47:29 -08:00
Bob Nystrom
15b0d8777c Handle toString not returning a string in IO.print and IO.write.
Fix #67.
2015-01-08 07:53:37 -08:00
Bob Nystrom
48dab5323d A few small cleanups. 2014-04-19 11:44:51 -07:00
Bob Nystrom
7393e12555 Allow multiple arguments to IO.print(). 2014-04-09 07:48:35 -07:00
Bob Nystrom
da4cadf16b Unify body handling.
Blocks, functions, and methods now have the same code for handling
their bodies.

This means that single-line methods work like single-line functions:
they return the result of their expression.
2014-04-03 07:48:19 -07:00
Bob Nystrom
b979272305 Clean up text handling a bit:
- Rename IO.write -> IO.print.
- Make IO.write not print a newline.
- Support \u Unicode escapes in strings.
2014-01-05 12:27:12 -08:00
Bob Nystrom
7868287f89 Make IO.write() call toString on its argument. 2013-12-22 11:50:00 -08:00