# Access to the environment variables of the process
module environ
-import symbol
+import string
# TODO prevoir une structure pour recup tout un environ, le modifier et le passer a process
-redef class Symbol
+redef class String
# Return environment value for this symbol
# If there is no such environment value, then return ""
fun environ: String
do
- var res = to_s.to_cstring.get_environ
+ var res = self.to_cstring.get_environ
# FIXME: There is no proper way to handle NULL C string yet. What a pitty.
var nulstr = once ("".to_cstring.get_environ)
if res != nulstr then
# Setup the paths value
paths.append(opt_path.value)
- var path_env = once ("NIT_PATH".to_symbol).environ
+ var path_env = "NIT_PATH".environ
if not path_env.is_empty then
paths.append(path_env.split_with(':'))
end
- path_env = once ("NIT_DIR".to_symbol).environ
+ path_env = "NIT_DIR".environ
if not path_env.is_empty then
var libname = "{path_env}/lib"
if libname.file_exists then paths.add(libname)
# Setup the paths value
paths.append(toolcontext.opt_path.value)
- var path_env = once ("NIT_PATH".to_symbol).environ
+ var path_env = "NIT_PATH".environ
if not path_env.is_empty then
paths.append(path_env.split_with(':'))
end
- path_env = once ("NIT_DIR".to_symbol).environ
+ path_env = "NIT_DIR".environ
if not path_env.is_empty then
var libname = "{path_env}/lib"
if libname.file_exists then paths.add(libname)
recvval.to_s.mkdir
return null
else if pname == "get_environ" then
- var txt = args.first.val.as(Buffer).to_s.to_symbol.environ
+ var txt = args.first.val.as(Buffer).to_s.environ
return v.native_string_instance(txt)
end
else if pname == "native_argc" then
if ext != null then ext_prefix = ext else ext_prefix = ""
compdir = opt_compdir.value
if compdir == null then
- var dir = once ("NIT_COMPDIR".to_symbol).environ
+ var dir = "NIT_COMPDIR".environ
if not dir.is_empty then
compdir = dir
end
clibdir = opt_clibdir.value
if clibdir == null then
- var dir = once ("NIT_DIR".to_symbol).environ
+ var dir = "NIT_DIR".environ
if dir.is_empty then
dir = "{sys.program_name.dirname}/../clib"
if dir.file_exists then clibdir = dir
bindir = opt_bindir.value
if bindir == null then
- var dir = once ("NIT_DIR".to_symbol).environ
+ var dir = "NIT_DIR".environ
if dir.is_empty then
dir = "{sys.program_name.dirname}/../bin"
if dir.file_exists then bindir = dir
sharedir = opt_sharedir.value
if sharedir == null then
- var dir = once ("NIT_DIR".to_symbol).environ
+ var dir = "NIT_DIR".environ
if dir.is_empty then
dir = "{sys.program_name.dirname}/../share/nitdoc"
if dir.file_exists then sharedir = dir