diff options
author | Ralph Amissah <ralph@amissah.com> | 2017-07-13 07:44:03 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:14 -0400 |
commit | 22cea68385b57a1593f5751e49cfdd41d8067997 (patch) | |
tree | 9e61339eb58679977c24962b1cfd2f50aa7f2998 /src/sdp/ao/read_config_files.d | |
parent | sdl extract and composite conf (make) (diff) |
0.18.0 rename meta from ao (considered adr)
Diffstat (limited to 'src/sdp/ao/read_config_files.d')
-rw-r--r-- | src/sdp/ao/read_config_files.d | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/src/sdp/ao/read_config_files.d b/src/sdp/ao/read_config_files.d deleted file mode 100644 index 8f525f3..0000000 --- a/src/sdp/ao/read_config_files.d +++ /dev/null @@ -1,80 +0,0 @@ -/++ - read configuration files<BR> - - read config files<BR> - ao_config_files.d -+/ -module sdp.ao.read_config_files; -template configIn() { - import - sdp.ao, - std.file, - std.path; - final string configIn(C,E)(C conf_sdl, E env) { - string dot_pwd = chainPath(to!string(env["pwd"]), ".sisu").array; - string underscore_pwd = chainPath(to!string(env["pwd"]), "_sisu").array; - string dot_home = chainPath(to!string(env["home"]), ".sisu").array; - string[] possible_config_path_locations = [ - dot_pwd, - underscore_pwd, - dot_home, - "/etc/sisu" - ]; - string config_file_str; - foreach(pth; possible_config_path_locations) { - auto conf_file = format( - "%s/%s", - pth, - conf_sdl, - ); - try { - if (exists(conf_file)) { - debug(configfile) { - writeln(conf_file); - } - config_file_str = conf_file.readText; - break; - } - } - catch (ErrnoException ex) { - } - catch (FileException ex) { - } - } - return config_file_str; - } -} -/+ - -+/ -template ConfigSDLang() { - import sdlang; - import - sdp.ao, - std.file, - std.path; - auto ConfigSDLang(string configuration, string conf_sdl_filename) { - Tag sdl_root_conf; - try { - sdl_root_conf = parseSource(configuration); - } - catch(ParseException e) { - stderr.writeln("SDLang problem with content for ", conf_sdl_filename); - stderr.writeln(e.msg); - } - return sdl_root_conf; - } -} -/+ -+/ -template configRead() { - import - sdp.ao, - std.file, - std.path; - - final auto configRead(C,E)(C conf_sdl, E env) { - auto configuration = configIn!()(conf_sdl, env); - auto sdl_root = ConfigSDLang!()(configuration, conf_sdl); - return sdl_root; - } -} |