From 60d6073bcfc4fa91253428094813de0dac41a2b4 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 9 May 2017 13:01:06 -0400 Subject: 0.16.0 files/modules re-arranged --- src/sdp/ao_read_config_files.d | 124 ----------------------------------------- 1 file changed, 124 deletions(-) delete mode 100644 src/sdp/ao_read_config_files.d (limited to 'src/sdp/ao_read_config_files.d') diff --git a/src/sdp/ao_read_config_files.d b/src/sdp/ao_read_config_files.d deleted file mode 100644 index b8d9890..0000000 --- a/src/sdp/ao_read_config_files.d +++ /dev/null @@ -1,124 +0,0 @@ -/++ - read configuration files
- - read config files
- ao_config_files.d -+/ -module sdp.ao_read_config_files; -template ConfigIn() { - private import - std.algorithm, - std.array, - std.container, - std.exception, - std.stdio, - std.file, - std.path, - std.range, - std.regex, - std.string, - std.traits, - std.typecons, - std.uni, - std.utf, - std.conv : to; - import std.file; - 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; - private import - std.algorithm, - std.array, - std.container, - std.exception, - std.stdio, - std.file, - std.path, - std.range, - std.regex, - std.string, - std.traits, - std.typecons, - std.uni, - std.utf, - std.conv : to; - 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); - } - debug(sdlang) { - Value output_dir_structure_by = sdl_root_conf.tags["output_dir_structure_by"][0].values[0]; - assert(output_dir_structure_by.type == typeid(string)); - writeln(output_dir_structure_by); - writeln("conf SDL:"); - writeln(sdl_root_conf.toSDLDocument()); - } - return sdl_root_conf; - } -} -/+ -+/ -template ConfigHub() { - private import - std.algorithm, - std.array, - std.container, - std.exception, - std.stdio, - std.file, - std.path, - std.range, - std.regex, - std.string, - std.traits, - std.typecons, - std.uni, - std.utf, - std.conv : to; - - final auto ConfigHub(C,E)(C conf_sdl, E env) { - auto configuration = ConfigIn!()(conf_sdl, env); - auto sdl_root = ConfigSDLang!()(configuration, conf_sdl); - return sdl_root; - } -} -- cgit v1.2.3