Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Introducing: IO::File, for existing files
Well, actually anything that's not a directory, at this stage
- Loading branch information
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # A class for file(path)s that we know exist | ||
| my class IO::File does IO::Local { | ||
|
|
||
| submethod BUILD(:$!abspath) { } | ||
|
|
||
| method open(IO::File:D: |c) { open( $!abspath, |c ) } | ||
|
|
||
| method copy(IO::File:D: $to as Str, :$createonly) { | ||
| COPY-FILE($!abspath, MAKE-ABSOLUTE-PATH($to,$*CWD ~ '/'), :$createonly); | ||
| } | ||
|
|
||
| method unlink(IO::File:D:) { UNLINK-PATH($!abspath) } | ||
|
|
||
| method link(IO::File:D: $name as Str) { | ||
| LINK-FILE($!abspath, MAKE-ABSOLUTE-PATH($name,$*CWD ~ '/')); | ||
| } | ||
|
|
||
| method d(IO::File:D:) { False } | ||
| } |