Language Change Specification Examples for Environment API
-- Check a configuration file in the user's home directory
use std.env.all;
use std.textio.all;
impure function GetConfig return boolean is
file config : text;
variable home, data : line;
variable result : boolean;
begin
home := GETENV("HOME");
assert home /= null report "No HOME environment variable";
FILE_OPEN(config,
home.all & DIR_SEPARATOR &
".config" & DIR_SEPARATOR &
"myapp.txt",
read_mode
);
READ_LINE(config, data);
READ(data, result);
FILE_CLOSE(config);
return result;
end function GetConfig;
--
Rob Gaddi - 2017-05-03
Comments
Topic revision: r1 - 2017-05-03 - 05:13:54 -
RobGaddi