Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove rm() as a duplicate of unlink(), but adopt its code into unlink()
  • Loading branch information
Tadeusz Sośnierz committed Feb 26, 2011
1 parent 61db95a commit 4cd9b96
Showing 1 changed file with 3 additions and 23 deletions.
26 changes: 3 additions & 23 deletions src/core/IO.pm
Expand Up @@ -226,23 +226,10 @@ sub slurp($filename) {
}

sub unlink($filename) {
Q:PIR {
.local string filename_str
.local pmc filename_pmc, os
.local int status
filename_pmc = find_lex '$filename'
filename_str = filename_pmc
os = root_new ['parrot';'OS']
push_eh unlink_catch
os.'rm'(filename_str)
status = 1
goto unlink_finally
unlink_catch:
status = 0
unlink_finally:
pop_eh
%r = box status
try {
pir::new__PS('OS').rm($path);
}
$! ?? fail($!) !! True
}

# CHEAT: This function is missing a bunch of arguments,
Expand Down Expand Up @@ -313,13 +300,6 @@ multi sub copy($src as Str, $dest as Str) {
$! ?? fail($!) !! True
}

multi sub rm($path as Str) {
try {
pir::new__PS('OS').rm($path);
}
$! ?? fail($!) !! True
}

multi sub link($src as Str, $dest as Str, Bool :$hard = False) {
if $hard {
try {
Expand Down

0 comments on commit 4cd9b96

Please sign in to comment.