Skip to content

Commit

Permalink
enable $*CWD & cwd() on rakudo.jvm
Browse files Browse the repository at this point in the history
  • Loading branch information
coke committed Jun 30, 2013
1 parent 718f45a commit 5679414
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/core/IO.pm
Expand Up @@ -566,16 +566,16 @@ multi sub spurt(Cool $filename,

proto sub cwd(|) { * }
multi sub cwd() {
#?if parrot
return nqp::p6box_s(
#?if parrot
pir::trans_encoding__Ssi(
nqp::cwd(),
pir::find_encoding__Is('utf8')));
pir::find_encoding__Is('utf8'))
#?endif
#?if !parrot
die "cwd is NYI on JVM backend";
nqp::cwd(),
#?endif

);
CATCH {
default {
X::IO::Cwd.new(
Expand Down
18 changes: 14 additions & 4 deletions src/core/terms.pm
Expand Up @@ -116,12 +116,22 @@ sub term:<time>() { nqp::p6box_i(nqp::time_i()) }
nqp::bindkey(nqp::who(PROCESS), '$OSVER', $OSVER);
#?endif

#?if !jvm
my $CWD = nqp::p6box_s(pir::trans_encoding__Ssi(
pir::new__PS('OS').cwd,
pir::find_encoding__Is('utf8'))).path;
## duplicate src/core/IO.pm::cwd
my $CWD = nqp::p6box_s(
#?if parrot
pir::trans_encoding__Ssi(
nqp::cwd(),
pir::find_encoding__Is('utf8'))
#?endif
#?if !parrot
nqp::cwd(),
#?endif
);

nqp::bindkey(nqp::who(PROCESS), '$CWD', $CWD);

#?if !jvm

my @INC;
@INC.push(%ENV<RAKUDOLIB>.split($VM<config><osname> eq 'MSWin32' ?? ';' !! ':')) if %ENV<RAKUDOLIB>;
@INC.push(%ENV<PERL6LIB>.split($VM<config><osname> eq 'MSWin32' ?? ';' !! ':')) if %ENV<PERL6LIB>;
Expand Down

0 comments on commit 5679414

Please sign in to comment.