Skip to content

Commit

Permalink
Better checks for being on Win
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Mar 6, 2015
1 parent 9a95f18 commit 9c66311
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/core/CompUnitRepo/Local/Installation.pm
Expand Up @@ -106,7 +106,7 @@ sub MAIN(:$name, :$auth, :$ver, *@pos, *%named) {
}
else {
if $file ~~ /^bin<[\\\/]>/ {
my $is-win := $*DISTRO.is-win;
state $is-win //= $*DISTRO.is-win; # only look up once
mkdir "$path/bin" unless "$path/bin".IO.d;
my $basename = $file.IO.basename;
my $withoutext = $basename;
Expand Down
9 changes: 5 additions & 4 deletions src/core/Exception.pm
Expand Up @@ -363,11 +363,12 @@ my role X::Comp is Exception {
has @.highexpect;
multi method gist(::?CLASS:D: :$sorry = True, :$expect = True) {
if $.is-compile-time {
my $color = %*ENV<RAKUDO_ERROR_COLOR> // $*DISTRO.name ne 'mswin32';
my $is-win := $*DISTRO.is-win;
my $color = %*ENV<RAKUDO_ERROR_COLOR> // !$is-win;
my ($red, $green, $yellow, $clear) = $color
?? ("\e[31m", "\e[32m", "\e[33m", "\e[0m")
!! ("", "", "", "");
my $eject = $*DISTRO.name eq 'MSWin32' ?? "<HERE>" !! "\x[23CF]";
my $eject = $is-win ?? "<HERE>" !! "\x[23CF]";
my $r = $sorry ?? self.sorry_heading() !! "";
$r ~= "$.message\nat $.filename():$.line\n------> ";
$r ~= "$green$.pre$yellow$eject$red$.post$clear" if defined $.pre;
Expand All @@ -390,7 +391,7 @@ my role X::Comp is Exception {
}
}
method sorry_heading() {
my $color = %*ENV<RAKUDO_ERROR_COLOR> // $*DISTRO.name ne 'mswin32';
my $color = %*ENV<RAKUDO_ERROR_COLOR> // !$*DISTRO.is-win;
my ($red, $clear) = $color ?? ("\e[31m", "\e[0m") !! ("", "");
"$red==={$clear}SORRY!$red===$clear Error while compiling $.filename\n"
}
Expand All @@ -411,7 +412,7 @@ my class X::Comp::Group is Exception {
multi method gist(::?CLASS:D:) {
my $r = "";
if $.panic || @.sorrows {
my $color = %*ENV<RAKUDO_ERROR_COLOR> // $*DISTRO.name ne 'mswin32';
my $color = %*ENV<RAKUDO_ERROR_COLOR> // !$*DISTRO.is-win;
my ($red, $clear) = $color ?? ("\e[31m", "\e[0m") !! ("", "");
$r ~= "$red==={$clear}SORRY!$red===$clear\n";
for @.sorrows {
Expand Down
5 changes: 3 additions & 2 deletions src/core/Label.pm
Expand Up @@ -23,11 +23,12 @@ my class Label {
# XXX method leave(@args)

multi method gist(Label:D:) {
my $color = %*ENV<RAKUDO_ERROR_COLOR> // !$*DISTRO.is-win;
my $is-win := $*DISTRO.is-win;
my $color = %*ENV<RAKUDO_ERROR_COLOR> // !$is-win;
my ($red, $green, $yellow, $clear) = $color
?? ("\e[31m", "\e[32m", "\e[33m", "\e[0m")
!! ("", "", "", "");
my $eject = $*DISTRO.is-win ?? "<HERE>" !! "\x[23CF]";
my $eject = $is-win ?? "<HERE>" !! "\x[23CF]";

"Label<$!name>(at $!file:$!line, '$green$!prematch$yellow$eject$red$!name$green$!postmatch$clear')"
}
Expand Down

0 comments on commit 9c66311

Please sign in to comment.