Skip to content

Commit

Permalink
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
lizmat committed Nov 3, 2014
1 parent c430c02 commit 2fcc17c
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/core/IO/File.pm
@@ -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 }
}

0 comments on commit 2fcc17c

Please sign in to comment.