diff options
author | Ralph Amissah <ralph@amissah.com> | 2018-01-25 17:13:52 -0500 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:14 -0400 |
commit | 524baa6ddd5f9cb49b1c5b015fbd6ef75ff72968 (patch) | |
tree | c66713d8559aa04f15f95825a6f5faec16827ce6 /org/default_paths.org | |
parent | 0.23.3 work on source & target file paths/locations (diff) |
paths, further adjustmentsdoc-reform_v0.0.23
Diffstat (limited to 'org/default_paths.org')
-rw-r--r-- | org/default_paths.org | 71 |
1 files changed, 49 insertions, 22 deletions
diff --git a/org/default_paths.org b/org/default_paths.org index 369e71b..5334a78 100644 --- a/org/default_paths.org +++ b/org/default_paths.org @@ -55,19 +55,30 @@ template PodManifest() { } auto pod_manifest_path() { string _manifest_path; - if (isValidPath(_pth) && _pth.isDir - && ((_pth.chainPath(pod_manifest_filename).array).isFile)) { + if ((isValidPath(_pth) && exists(_pth)!=0 && _pth.isDir) + && (exists(_pth.chainPath(pod_manifest_filename).array)!=0 + && (_pth.chainPath(pod_manifest_filename).array).isFile)) { _manifest_path = _pth; } else if (_pth.match(rgx.src_pth_contents) - && (_pth.isFile)) { + && exists(_pth)!=0 && _pth.isDir && (_pth.isFile)) { _manifest_path = dirName(_pth); - // } else { // _manifest_path = ""; + } else { + _manifest_path = _pth; // _manifest_path = null; } return _manifest_path; } - auto pod_manifest_file_with_path() { - string _manifest_path_and_file = pod_manifest_path.chainPath(pod_manifest_filename).array; - return _manifest_path_and_file; + string pod_manifest_file_with_path() { + string _k; + if (exists(pod_manifest_path.chainPath(pod_manifest_filename).array)!=0) { + _k = pod_manifest_path.chainPath(pod_manifest_filename).array; + } else if (exists(pod_manifest_path)!=0) { + _k = pod_manifest_path; + } + if (exists(_k)==0) { + writeln("ERROR >> Processing Skipped! Manifest not found: ", _k); + _k = null; + } + return _k; } } return ManifestFile_(); @@ -176,6 +187,9 @@ template PathMatters() { } return _k; } + auto language() { + return lng(); + } auto file_with_absolute_path() { string _pth = _env["pwd"].chainPath(path_and_fn).array; return _pth; @@ -190,13 +204,15 @@ template PathMatters() { auto m = (absolute_path_to_src) .match(regex(r"[/](?P<dir>(?:[a-zA-Z0-9._-]+))/sisupod/" ~ filename.stripExtension)) ) { - _dir = asAbsolutePath(path_and_fn.chainPath("../../")).array; + _dir = asNormalizedPath(path_and_fn.chainPath("../../")).array; assert(_dir == m.captures["dir"]); } else { - _dir = asAbsolutePath(path_and_fn.chainPath("../../../")).array; + _dir = asNormalizedPath(path_and_fn.chainPath("../../../")).array; assert(_dir == absolute_path_to_src.match(rgx.src_base_parent_dir_name).captures["dir"]); } - writeln("--> ", _dir); + if ((_opt_actions.debug_do)) { + writeln("--> (base_dir) ", _dir); + } return _dir; } auto base_parent_dir_path() { @@ -205,35 +221,42 @@ template PathMatters() { auto m = (absolute_path_to_src) .match(regex(r"[/](?P<dir>(?:[a-zA-Z0-9._-]+))/sisupod/" ~ filename.stripExtension)) ) { - _dir = asAbsolutePath(path_and_fn.chainPath("../../")).array; + _dir = asNormalizedPath(path_and_fn.chainPath("../../")).array; } else { - _dir = asAbsolutePath(path_and_fn.chainPath("../../../")).array; + _dir = asNormalizedPath(path_and_fn.chainPath("../../../")).array; } return _dir; } auto base_dir_path() { // looks like there is work to do string _dir; - if ( // TODO this should catch generated --source sisupod, untested, needs manifest + if ( auto m = (absolute_path_to_src) - .match(regex(r"[/](?P<dir>(?:[a-zA-Z0-9._-]+))/sisupod/" ~ filename.stripExtension)) + .match(rgx.src_formalised_file_path_parts) + ) { + _dir = asNormalizedPath(m.captures["pth"]).array; + } else if ( // TODO this should catch generated --source sisupod, untested, needs manifest + auto m = (absolute_path_to_src) + .match(regex(r"[/](?P<dir>(?:[a-zA-Z0-9._-]+))/sisupod/" ~ filename.stripExtension)) ) { - _dir = asAbsolutePath(path_and_fn.chainPath("../")).array; + _dir = asNormalizedPath(path_and_fn.chainPath("../")).array; } else { - _dir = asAbsolutePath(path_and_fn.chainPath("../../")).array; + _dir = asNormalizedPath(path_and_fn.chainPath("../../")).array; + } + if ((_opt_actions.debug_do)) { + writeln("--> (base_dir_path) ", _dir); } - writeln("--> ", _dir); return _dir; } auto media_dir_path() { // TODO rework, can base directly on src fn path - auto _dir = asAbsolutePath(base_dir_path.chainPath("media")).array; + string _dir = asNormalizedPath(base_dir_path.chainPath("media")).array; return _dir; } auto image_dir_path() { - auto _dir = asAbsolutePath(base_dir_path.chainPath("media/image")).array; + string _dir = asNormalizedPath(base_dir_path.chainPath("media/image")).array; return _dir; } auto conf_dir_path() { - auto _dir = asAbsolutePath(base_dir_path.chainPath("conf")).array; + auto _dir = asNormalizedPath(base_dir_path.chainPath("conf")).array; return _dir; } auto base_parent_dir() { @@ -246,7 +269,9 @@ template PathMatters() { } else { _dir = (absolute_path_to_src).match(rgx.src_base_parent_dir_name).captures["dir"]; } - writeln("--> ", _dir); + if ((_opt_actions.debug_do)) { + writeln("--> (base_parent_dir) ", _dir); + } return _dir; } auto config_dirs() { // TODO @@ -1011,7 +1036,7 @@ template SiSUpathsSQLite() { return fn_src.baseName.stripExtension; } string base() { - return asNormalizedPath((out_pth.output_base).chainPath(base_dir)).array; + return asNormalizedPath((out_pth.output_root).chainPath(base_dir)).array; } string seg(string fn_src) { return asNormalizedPath(base.chainPath(base_filename(fn_src))).array; @@ -1024,3 +1049,5 @@ template SiSUpathsSQLite() { } } #+END_SRC + +* __END__ |