/+ ao_config_files.d - read config files +/ template SiSUconfiguration() { private import std.exception, // std.regex, std.stdio, std.utf, std.conv : to; // private import // ao_rgx; // ao_defaults.d // mixin RgxInit; // auto rgx = Rgx(); private struct Config { private import std.file; final private string readInConfigFile() { // enforce( // exists(fn_src)!=0, // "file not found" // ); string[] possible_config_path_locations = [ environment["PWD"] ~ "/.sisu", environment["PWD"] ~ "/_sisu", environment["HOME"] ~ "/.sisu", "/etc/sisu" ]; string conf_sdl = "conf.sdl"; string config_file_str; foreach(pth; possible_config_path_locations) { auto conf_file = format( "%s/%s", pth, conf_sdl, ); // writeln(conf_file); try { if (exists(conf_file)) { writeln(conf_file); config_file_str = readText(conf_file); break; } } catch (ErrnoException ex) { //// Handle errors // switch(ex.errno) { // case EPERM: // case EACCES: // // Permission denied // break; // case ENOENT: // // File does not exist // break; // default: // // Handle other errors // break; // } } // catch (UTFException ex) { // // Handle validation errors // } catch (FileException ex) { // Handle errors } } return config_file_str; } } }