From 1f390cbff2500f373721021b97ca47a813b6b671 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 28 Nov 2017 10:16:13 -0500 Subject: paths, manifest --- org/default_paths.org | 29 +++++++++++++++++------------ org/sdp.org | 6 +++--- src/sdp/output/paths_source.d | 29 +++++++++++++++++------------ src/sdp/sdp.d | 6 +++--- 4 files changed, 40 insertions(+), 30 deletions(-) diff --git a/org/default_paths.org b/org/default_paths.org index 805e8a9..623584e 100644 --- a/org/default_paths.org +++ b/org/default_paths.org @@ -42,29 +42,33 @@ import sdp.meta.rgx; #+name: template_paths_src #+BEGIN_SRC d -template ManifestFile() { +template PodManifest() { mixin SiSUrgxInit; static auto rgx = Rgx(); - auto ManifestFile(P)( + auto PodManifest(P)( P _pth, ) { struct ManifestFile_ { - auto manifest_file() { + auto pod_manifest_filename() { string _manifest_file = "sisudoc.txt"; return _manifest_file; } - auto manifest_file_and_path() { - string _manifest_file_and_path; + auto pod_manifest_path() { + string _manifest_path; if (isValidPath(_pth) && _pth.isDir - && ((_pth.chainPath(manifest_file).array).isFile)) { - _manifest_file_and_path = _pth.chainPath(manifest_file).array; + && ((_pth.chainPath(pod_manifest_filename).array).isFile)) { + _manifest_path = _pth; } else if (_pth.match(rgx.src_pth_contents) && (_pth.isFile)) { - _manifest_file_and_path = _pth; + _manifest_path = dirName(_pth); } else { - // _manifest_file_and_path = ""; + // _manifest_path = ""; } - return _manifest_file_and_path; + 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; } } return ManifestFile_(); @@ -460,8 +464,9 @@ template SiSUpathsSisupods() { } auto fn_pod_filelist(string fn_src) { auto pod_root_ = pod_root(fn_src); - auto pth_1_ = "sisudoc.txt"; - auto pth_2_ = pod_root(fn_src).filesystem_open_zpod.chainPath("sisudoc.txt").array; + auto _manifest = PodManifest!()(fn_src).pod_manifest_filename; + auto pth_1_ = _manifest; + auto pth_2_ = pod_root(fn_src).filesystem_open_zpod.chainPath(_manifest).array; struct _pods { auto zpod() { return pth_1_; diff --git a/org/sdp.org b/org/sdp.org index e6b26fc..fb00a4b 100644 --- a/org/sdp.org +++ b/org/sdp.org @@ -485,14 +485,14 @@ auto _opt_action = OptActions(); #+NAME: sdp_args #+BEGIN_SRC d foreach(arg; args[1..$]) { - auto _manifest = ManifestFile!()(arg); + auto _manifest = PodManifest!()(arg); if (arg.match(rgx.flag_action)) { flag_action ~= " " ~ arg; // flags not taken by getopt } else if (arg.match(rgx.src_pth)) { fns_src ~= arg; // gather input markup source file names for processing - } else if (_manifest.manifest_file_and_path) { + } else if (_manifest.pod_manifest_file_with_path) { string contents_location_; - string sisudoc_txt_ = _manifest.manifest_file_and_path; + string sisudoc_txt_ = _manifest.pod_manifest_file_with_path; enforce( exists(sisudoc_txt_)!=0, "file not found: «" ~ diff --git a/src/sdp/output/paths_source.d b/src/sdp/output/paths_source.d index 1fd87e5..de14b23 100644 --- a/src/sdp/output/paths_source.d +++ b/src/sdp/output/paths_source.d @@ -11,29 +11,33 @@ import std.array, std.stdio, std.conv : to; import sdp.meta.rgx; -template ManifestFile() { +template PodManifest() { mixin SiSUrgxInit; static auto rgx = Rgx(); - auto ManifestFile(P)( + auto PodManifest(P)( P _pth, ) { struct ManifestFile_ { - auto manifest_file() { + auto pod_manifest_filename() { string _manifest_file = "sisudoc.txt"; return _manifest_file; } - auto manifest_file_and_path() { - string _manifest_file_and_path; + auto pod_manifest_path() { + string _manifest_path; if (isValidPath(_pth) && _pth.isDir - && ((_pth.chainPath(manifest_file).array).isFile)) { - _manifest_file_and_path = _pth.chainPath(manifest_file).array; + && ((_pth.chainPath(pod_manifest_filename).array).isFile)) { + _manifest_path = _pth; } else if (_pth.match(rgx.src_pth_contents) && (_pth.isFile)) { - _manifest_file_and_path = _pth; + _manifest_path = dirName(_pth); } else { - // _manifest_file_and_path = ""; + // _manifest_path = ""; } - return _manifest_file_and_path; + 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; } } return ManifestFile_(); @@ -360,8 +364,9 @@ template SiSUpathsSisupods() { } auto fn_pod_filelist(string fn_src) { auto pod_root_ = pod_root(fn_src); - auto pth_1_ = "sisudoc.txt"; - auto pth_2_ = pod_root(fn_src).filesystem_open_zpod.chainPath("sisudoc.txt").array; + auto _manifest = PodManifest!()(fn_src).pod_manifest_filename; + auto pth_1_ = _manifest; + auto pth_2_ = pod_root(fn_src).filesystem_open_zpod.chainPath(_manifest).array; struct _pods { auto zpod() { return pth_1_; diff --git a/src/sdp/sdp.d b/src/sdp/sdp.d index a9f63e2..af3a0a0 100755 --- a/src/sdp/sdp.d +++ b/src/sdp/sdp.d @@ -300,14 +300,14 @@ void main(string[] args) { } auto _opt_action = OptActions(); foreach(arg; args[1..$]) { - auto _manifest = ManifestFile!()(arg); + auto _manifest = PodManifest!()(arg); if (arg.match(rgx.flag_action)) { flag_action ~= " " ~ arg; // flags not taken by getopt } else if (arg.match(rgx.src_pth)) { fns_src ~= arg; // gather input markup source file names for processing - } else if (_manifest.manifest_file_and_path) { + } else if (_manifest.pod_manifest_file_with_path) { string contents_location_; - string sisudoc_txt_ = _manifest.manifest_file_and_path; + string sisudoc_txt_ = _manifest.pod_manifest_file_with_path; enforce( exists(sisudoc_txt_)!=0, "file not found: «" ~ -- cgit v1.2.3