From 2e852762085122d1b36641a04bcc63d5235139cd Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 15 Dec 2017 14:06:16 -0500 Subject: 0.23.2 config paths for pod --- org/default_paths.org | 87 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 65 insertions(+), 22 deletions(-) (limited to 'org/default_paths.org') diff --git a/org/default_paths.org b/org/default_paths.org index f40ebdf..e18d3a5 100644 --- a/org/default_paths.org +++ b/org/default_paths.org @@ -154,9 +154,16 @@ template PodMatters() { ) { _output_path = asNormalizedPath(_opt_actions.output_dir_set).array; if (!exists(_output_path)) { - _output_path.mkdirRecurse; + try { + _output_path.mkdirRecurse; + } + catch (Exception ex) { + // Handle error + } } - assert(_output_path.isDir); + assert(_output_path.isDir, + "not a directory: " ~ _output_path); + // TODO always test that is a directory and it is writable } return _output_path; } @@ -187,34 +194,70 @@ template PodMatters() { template ConfigFilePaths() { mixin SiSUrgxInit; static auto rgx = Rgx(); - auto ConfigFilePaths(E)( + auto ConfigFilePaths(M,E)( + M _manifest, E _env, ) { struct ConfFilePaths { auto possible_config_path_locations() { /+ FIX clean up conf paths ↓ +/ - string _sisudoc_conf_pwd = chainPath(to!string(_env["pwd"]), "sisudoc/conf").array; - string _sisudoc_conf_pwd_a = chainPath(to!string(_env["pwd"]), "conf").array; - string _sisudoc_conf_pwd_b = chainPath(to!string(_env["pwd"]), "../conf").array; - string _sisudoc_conf_pwd_c = chainPath(to!string(_env["pwd"]), "../../conf").array; - string _sisudoc_conf_pwd_d = chainPath(to!string(_env["pwd"]), "../../../conf").array; + /+ config local site (file system only, not in pod) +/ + string _dot_pwd; + string _underscore_pwd; + string _dot_home; + /+ config document (& or local site) on filesystem +/ + string _sisudoc_conf_pwd; // think about + string _sisudoc_conf_pwd_a; + string _sisudoc_conf_pwd_b; + string _sisudoc_conf_pwd_c; + string _sisudoc_conf_pwd_d; + /+ config document in pod +/ + string _sisudoc_conf_pod; + string _sisudoc_conf_pod_text; + /+ return paths +/ + string[] _possible_config_path_locations; + if (_manifest.is_pod) { + /+ config document in pod +/ + _sisudoc_conf_pod = asNormalizedPath(chainPath( + to!string(_env["pwd"]), + _manifest.pod_manifest_path ~ "/conf" + )).array; + _sisudoc_conf_pod_text = asNormalizedPath(chainPath( + to!string(_env["pwd"]), + _manifest.pod_manifest_path ~ "/media/text/" ~ _manifest.src_lng ~ "/conf" + )).array; + /+ return paths +/ + _possible_config_path_locations = [ + _sisudoc_conf_pod_text, + _sisudoc_conf_pod, + ]; + } else { + /+ config local site (file system only, not in pod) +/ + _dot_pwd = asNormalizedPath(chainPath(to!string(_env["pwd"]), ".sisu")).array; + _underscore_pwd = asNormalizedPath(chainPath(to!string(_env["pwd"]), "_sisu")).array; + _dot_home = asNormalizedPath(chainPath(to!string(_env["home"]), ".sisu")).array; + /+ config document (& or local site) on filesystem +/ + _sisudoc_conf_pwd = asNormalizedPath(chainPath(to!string(_env["pwd"]), "sisudoc/conf")).array; // think about + _sisudoc_conf_pwd_a = asNormalizedPath(chainPath(to!string(_env["pwd"]), "conf")).array; + _sisudoc_conf_pwd_b = asNormalizedPath(chainPath(to!string(_env["pwd"]), "../conf")).array; + _sisudoc_conf_pwd_c = asNormalizedPath(chainPath(to!string(_env["pwd"]), "../../conf")).array; + _sisudoc_conf_pwd_d = asNormalizedPath(chainPath(to!string(_env["pwd"]), "../../../conf")).array; + /+ return paths +/ + _possible_config_path_locations = [ + _sisudoc_conf_pwd, + _sisudoc_conf_pwd_a, + _sisudoc_conf_pwd_b, + _sisudoc_conf_pwd_c, + _sisudoc_conf_pwd_d, + _dot_pwd, + _underscore_pwd, + _dot_home, + "/etc/sisu" + ]; + } /+ FIX clean up conf paths ↑ (compare pwd to doc path location, and build config path) +/ - 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 = [ - _sisudoc_conf_pwd, - _sisudoc_conf_pwd_a, - _sisudoc_conf_pwd_b, - _sisudoc_conf_pwd_c, - _sisudoc_conf_pwd_d, - _dot_pwd, - _underscore_pwd, - _dot_home, - "/etc/sisu" - ]; return _possible_config_path_locations; } } -- cgit v1.2.3