aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/default_paths.org
diff options
context:
space:
mode:
Diffstat (limited to 'org/default_paths.org')
-rw-r--r--org/default_paths.org153
1 files changed, 91 insertions, 62 deletions
diff --git a/org/default_paths.org b/org/default_paths.org
index 459d8b9..ed47cac 100644
--- a/org/default_paths.org
+++ b/org/default_paths.org
@@ -217,6 +217,9 @@ template PathMatters() {
string pod_name_with_path() {
return (is_pod) ? _manifested.pod_manifest_path : "";
}
+ string pods_collection_root_path() {
+ return (is_pod) ? _manifested.pods_collection_root_path : "";
+ }
string pod_name() {
return pod_name_with_path.baseName;
}
@@ -301,6 +304,9 @@ template PathMatters() {
string absolute_path_to_src() {
return (_env["pwd"].chainPath(path_and_fn)).dirName.array;
}
+ string path_to_doc_root_path_to_lang_and_filename() {
+ return _env["pwd"].chainPath(path_and_fn).array;
+ }
string base_dir() {
string _dir;
if (
@@ -413,7 +419,17 @@ template PathMatters() {
return SRC_();
}
auto output() {
- auto _opt_actions = _opt_actions;
+ /+
+ - command line if output path set
+ - config file if found and set set
+ - search for and if exists read config
+ - default paths to config related to:
+ - source markup path;
+ - current dir;
+ - home dir
+ - get output path if set
+ - (program) default within current directory?
+ +/
auto _env = _env;
struct Out_ {
auto path() {
@@ -453,8 +469,9 @@ template ConfigFilePaths() {
mixin DocReformRgxInit;
static auto rgx = Rgx();
auto ConfigFilePaths(M,E)(
- M _manifested,
- E _env,
+ M _manifested,
+ E _env,
+ string _cli_config_path_set = ""
) {
struct ConfFilePaths {
string config_filename_document() {
@@ -470,37 +487,43 @@ template ConfigFilePaths() {
/+ config local site (file system only, not in pod) +/
/+ return paths +/
string[] _possible_config_path_locations;
- if (_manifested.src.is_pod) {
- /+ config document in pod +/
- string _dr_doc_conf_pod;
- string _dr_doc_conf_pod_text;
- _dr_doc_conf_pod = asNormalizedPath(chainPath(
- to!string(_env["pwd"]),
- _manifested.pod.manifest_path ~ "/conf"
- )).array;
- _dr_doc_conf_pod_text = asNormalizedPath(chainPath(
- to!string(_env["pwd"]),
- _manifested.pod.manifest_path ~ "/media/text/" ~ _manifested.src.lng ~ "/conf"
- )).array;
- /+ return paths +/
- _possible_config_path_locations = [
- _dr_doc_conf_pod_text,
- _dr_doc_conf_pod,
- ];
+ if (_cli_config_path_set.empty) {
+ if (_manifested.src.is_pod) {
+ /+ config document in pod +/
+ string _dr_doc_conf_pod;
+ string _dr_doc_conf_pod_text;
+ _dr_doc_conf_pod = asNormalizedPath(chainPath(
+ to!string(_env["pwd"]),
+ _manifested.pod.manifest_path ~ "/conf"
+ )).array;
+ _dr_doc_conf_pod_text = asNormalizedPath(chainPath(
+ to!string(_env["pwd"]),
+ _manifested.pod.manifest_path ~ "/media/text/" ~ _manifested.src.lng ~ "/conf"
+ )).array;
+ /+ return paths +/
+ _possible_config_path_locations = [
+ _dr_doc_conf_pod_text,
+ _dr_doc_conf_pod,
+ ];
+ } else {
+ /+ config document (& or local site) on filesystem +/
+ string _dr_doc_conf_pwd = ((chainPath(to!string(_env["pwd"]), "dr_doc/conf")).asNormalizedPath).array; // think about
+ string _dr_doc_conf_pwd_a = ((chainPath(to!string(_env["pwd"]), "conf")).asNormalizedPath).array;
+ string _dr_doc_conf_pwd_b = ((chainPath(to!string(_env["pwd"]), "../conf")).asNormalizedPath).array;
+ string _dr_doc_conf_pwd_c = ((chainPath(to!string(_env["pwd"]), "../../conf")).asNormalizedPath).array;
+ string _dr_doc_conf_pwd_d = ((chainPath(to!string(_env["pwd"]), "../../../conf")).asNormalizedPath).array;
+ /+ return paths +/
+ _possible_config_path_locations = [
+ _dr_doc_conf_pwd,
+ _dr_doc_conf_pwd_a,
+ _dr_doc_conf_pwd_b,
+ _dr_doc_conf_pwd_c,
+ _dr_doc_conf_pwd_d,
+ ];
+ }
} else {
- /+ config document (& or local site) on filesystem +/
- string _dr_doc_conf_pwd = ((chainPath(to!string(_env["pwd"]), "dr_doc/conf")).asNormalizedPath).array; // think about
- string _dr_doc_conf_pwd_a = ((chainPath(to!string(_env["pwd"]), "conf")).asNormalizedPath).array;
- string _dr_doc_conf_pwd_b = ((chainPath(to!string(_env["pwd"]), "../conf")).asNormalizedPath).array;
- string _dr_doc_conf_pwd_c = ((chainPath(to!string(_env["pwd"]), "../../conf")).asNormalizedPath).array;
- string _dr_doc_conf_pwd_d = ((chainPath(to!string(_env["pwd"]), "../../../conf")).asNormalizedPath).array;
- /+ return paths +/
_possible_config_path_locations = [
- _dr_doc_conf_pwd,
- _dr_doc_conf_pwd_a,
- _dr_doc_conf_pwd_b,
- _dr_doc_conf_pwd_c,
- _dr_doc_conf_pwd_d,
+ _cli_config_path_set
];
}
/+ FIX clean up conf paths ↑
@@ -511,39 +534,45 @@ template ConfigFilePaths() {
string[] config_local_site() {
/+ FIX clean up conf paths ↓ +/
/+ config local site (file system only, not in pod) +/
- string _dot_pwd = ((chainPath(to!string(_env["pwd"]), ".dr")).asNormalizedPath).array;
- string _underscore_pwd = ((chainPath(to!string(_env["pwd"]), "_dr")).asNormalizedPath).array;
- string _dot_home = ((chainPath(to!string(_env["home"]), ".dr")).asNormalizedPath).array;
- /+ return paths +/
string[] _possible_config_path_locations;
- if (_manifested.src.is_pod) {
- string _collection_root_a = ((chainPath(to!string(_manifested.pod.collection_root.to!string), ".dr")).asNormalizedPath).array;
- string _collection_root_b = ((chainPath(to!string(_manifested.pod.collection_root.to!string), "_dr")).asNormalizedPath).array;
- _possible_config_path_locations = [
- _dot_pwd,
- _underscore_pwd,
- _dot_home,
- "/etc/dr",
- _collection_root_a, // set priority higher?
- _collection_root_b // set priority higher?
- ];
+ if (_cli_config_path_set.empty) {
+ string _dot_pwd = ((chainPath(to!string(_env["pwd"]), ".dr")).asNormalizedPath).array;
+ string _underscore_pwd = ((chainPath(to!string(_env["pwd"]), "_dr")).asNormalizedPath).array;
+ string _dot_home = ((chainPath(to!string(_env["home"]), ".dr")).asNormalizedPath).array;
+ /+ return paths +/
+ if (_manifested.src.is_pod) {
+ string _collection_root_a = ((chainPath(to!string(_manifested.pod.collection_root.to!string), ".dr")).asNormalizedPath).array;
+ string _collection_root_b = ((chainPath(to!string(_manifested.pod.collection_root.to!string), "_dr")).asNormalizedPath).array;
+ _possible_config_path_locations = [
+ _dot_pwd,
+ _underscore_pwd,
+ _dot_home,
+ "/etc/dr",
+ _collection_root_a, // set priority higher?
+ _collection_root_b // set priority higher?
+ ];
+ } else {
+ /+ config document (& or local site) on filesystem +/
+ string _dr_doc_conf_pwd = ((chainPath(to!string(_env["pwd"]), "dr_doc/conf")).asNormalizedPath).array;
+ string _dr_doc_conf_pwd_a = ((chainPath(to!string(_env["pwd"]), "conf")).asNormalizedPath).array;
+ string _dr_doc_conf_pwd_b = ((chainPath(to!string(_env["pwd"]), "../conf")).asNormalizedPath).array;
+ string _dr_doc_conf_pwd_c = ((chainPath(to!string(_env["pwd"]), "../../conf")).asNormalizedPath).array;
+ string _dr_doc_conf_pwd_d = ((chainPath(to!string(_env["pwd"]), "../../../conf")).asNormalizedPath).array;
+ _possible_config_path_locations = [
+ _dr_doc_conf_pwd,
+ _dr_doc_conf_pwd_a,
+ _dr_doc_conf_pwd_b,
+ _dr_doc_conf_pwd_c,
+ _dr_doc_conf_pwd_d,
+ _dot_pwd,
+ _underscore_pwd,
+ _dot_home,
+ "/etc/dr"
+ ];
+ }
} else {
- /+ config document (& or local site) on filesystem +/
- string _dr_doc_conf_pwd = ((chainPath(to!string(_env["pwd"]), "dr_doc/conf")).asNormalizedPath).array;
- string _dr_doc_conf_pwd_a = ((chainPath(to!string(_env["pwd"]), "conf")).asNormalizedPath).array;
- string _dr_doc_conf_pwd_b = ((chainPath(to!string(_env["pwd"]), "../conf")).asNormalizedPath).array;
- string _dr_doc_conf_pwd_c = ((chainPath(to!string(_env["pwd"]), "../../conf")).asNormalizedPath).array;
- string _dr_doc_conf_pwd_d = ((chainPath(to!string(_env["pwd"]), "../../../conf")).asNormalizedPath).array;
_possible_config_path_locations = [
- _dr_doc_conf_pwd,
- _dr_doc_conf_pwd_a,
- _dr_doc_conf_pwd_b,
- _dr_doc_conf_pwd_c,
- _dr_doc_conf_pwd_d,
- _dot_pwd,
- _underscore_pwd,
- _dot_home,
- "/etc/dr"
+ _cli_config_path_set
];
}
/+ FIX clean up conf paths ↑