1
0
forked from Mirror/wren

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.
This commit is contained in:
Bob Nystrom
2016-02-27 15:53:02 -08:00
parent e6b48de598
commit 1e4b9e5175
7 changed files with 55 additions and 0 deletions

View File

@ -51,6 +51,15 @@ No encoding or decoding is done. If the file is UTF-8, then the resulting
string will be a UTF-8 string. Otherwise, it will be a string of bytes in
whatever encoding the file uses.
### File.**realPath**(path)
Resolves `path`, traversing symlinks and removining any unneeded `./` and `../`
components. Returns the canonical absolute path to the file.
:::wren
var path = "/some/./symlink/a/../b/file.txt"
System.print(File.realPath(path)) //> /real/path/a/file.txt
### File.**size**(path)
Returns the size in bytes of the contents of the file at `path`.