diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2019-11-14 11:16:09 -0500 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2019-11-19 16:55:31 -0500 |
commit | d61236952f19c1a1107a11cf11874104c0fe1a9b (patch) | |
tree | 838d700a639cdb358fe744361fc593b453de03b8 /org/source_files_read.org | |
parent | makefile program version tagging for bin-archive (diff) |
0.8.3 (if exists) get site config & output pathdoc-reform_v0.8.3
- read once & read early:
- once per batch processing
- early (needed by metadata --harvest)
Diffstat (limited to 'org/source_files_read.org')
-rw-r--r-- | org/source_files_read.org | 57 |
1 files changed, 33 insertions, 24 deletions
diff --git a/org/source_files_read.org b/org/source_files_read.org index 8549cda..e182475 100644 --- a/org/source_files_read.org +++ b/org/source_files_read.org @@ -51,30 +51,42 @@ static template readConfigSite() { doc_reform.meta.rgx; <<imports_std>> mixin DocReformRgxInit; - final auto readConfigSite(M,E)(M _manifested, E _env) { + final auto readConfigSite(M,E)( + M _manifested, + E _env, + string _cli_config_path_set = "" + ) { static auto rgx = Rgx(); string config_file_str; string conf_filename = "NONE"; - auto _conf_file_details = ConfigFilePaths!()(_manifested, _env); + auto _conf_file_details = ConfigFilePaths!()(_manifested, _env, _cli_config_path_set); string[] possible_config_path_locations = _conf_file_details.possible_config_path_locations.config_local_site; foreach(conf_fn; [_conf_file_details.config_filename_site]) { foreach(pth; possible_config_path_locations) { - char[] conf_file = ((chainPath(pth.to!string, conf_fn)).asNormalizedPath).array; + char[] conf_file; conf_filename = conf_fn; - if (config_file_str.length > 0) { - // conf_filename = conf_fn; - break; - } - try { - if (exists(conf_file)) { - debug(io) { - writeln("WARNING (io debug) in config file found: ", conf_file); + if (exists(pth)) { + auto f_attrib = pth.getLinkAttributes; + if ( + possible_config_path_locations.length == 1 + && f_attrib.attrIsFile + ) { + conf_file = pth.to!(char[]); + conf_filename = pth.baseName; + } else if (f_attrib.attrIsDir) { + conf_file = ((chainPath(pth.to!string, conf_fn)).asNormalizedPath).array; + conf_filename = conf_fn; + } + try { + if (exists(conf_file)) { + if (conf_file.getLinkAttributes.attrIsFile) { + config_file_str = conf_file.readText; + break; + } } - config_file_str = conf_file.readText; - break; + } catch (ErrnoException ex) { + } catch (FileException ex) { } - } catch (ErrnoException ex) { - } catch (FileException ex) { } } if (config_file_str.length > 0) { break; } @@ -119,16 +131,14 @@ static template readConfigDoc() { auto conf_file = ((chainPath(pth.to!string, conf_fn)).asNormalizedPath).array; conf_filename = conf_fn; if (config_file_str.length > 0) { - // conf_filename = conf_fn; break; } try { if (exists(conf_file)) { - debug(io) { - writeln("WARNING (io debug) in config file found: ", conf_file); + if (conf_file.getLinkAttributes.attrIsFile) { + config_file_str = conf_file.readText; + break; } - config_file_str = conf_file.readText; - break; } } catch (ErrnoException ex) { } catch (FileException ex) { @@ -182,7 +192,6 @@ static template configYAML() { #+BEGIN_SRC d static template configReadSiteYAML() { <<imports_std>> - import dyaml; final YAMLDocument configReadSiteYAML(M,E)(M _manifested, E _env) { string _configuration = configReadInSiteYAML!()(_manifested, _env); auto _conf_file_details = ConfigFilePaths!()(_manifested, _env); @@ -332,10 +341,10 @@ final private string readInMarkupSource(in char[] fn_src) { string source_txt_str; try { if (exists(fn_src)) { - debug(io) { - writeln("in src, markup source file found: ", fn_src); + if (fn_src.getLinkAttributes.attrIsFile) { + source_txt_str = fn_src.readText; + } else { } - source_txt_str = fn_src.readText; } } catch (ErrnoException ex) { } catch (UTFException ex) { |