-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This class acts as a central point where configuration information is stored. The class should only ever be accessed via `nqp::gethllsym('default', 'SysConfig')`. This then allows the class to be overridden by a subclass.
- Loading branch information
1 parent
39ba5f1
commit d2a35ac
Showing
6 changed files
with
53 additions
and
39 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
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,38 @@ | ||
class HLL::SysConfig { | ||
has %!build-config; | ||
has $!nqp-home; | ||
has $!path-sep; | ||
|
||
method BUILD() { | ||
%!build-config := nqp::hash(); | ||
hll-config(%!build-config); | ||
|
||
$!path-sep := nqp::backendconfig<osname> eq 'MSWin32' ?? '\\' !! '/'; | ||
|
||
# Determine NQP home | ||
#?if jvm | ||
# TODO could be replaced by nqp::execname() after the next bootstrap for JVM | ||
my $execname := nqp::atkey(nqp::jvmgetproperties,'nqp.execname') // ''; | ||
#?endif | ||
#?if !jvm | ||
my $execname := nqp::execname; | ||
#?endif | ||
my $install-dir := $execname eq '' | ||
?? %!build-config<prefix> | ||
!! nqp::substr($execname, 0, nqp::rindex($execname, $!path-sep, nqp::rindex($execname, $!path-sep) - 1)); | ||
|
||
$!nqp-home := nqp::getenvhash<NQP_HOME> | ||
// %!build-config<static-nqp-home> | ||
|| $install-dir ~ '/share/nqp'; | ||
if nqp::substr($!nqp-home, nqp::chars($!nqp-home) - 1) eq $!path-sep { | ||
$!nqp-home := nqp::substr($!nqp-home, 0, nqp::chars($!nqp-home) - 1); | ||
} | ||
} | ||
|
||
method path-sep() { $!path-sep } | ||
|
||
method nqp-build-config() { %!build-config } | ||
|
||
method nqp-home() { $!nqp-home } | ||
} | ||
|
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
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
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
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