1+ # ' Construct of the file path inside an app workspace
2+ # '
3+ # ' @param app this app parameter value could be in 3 kinds
4+ # ' of data type:
5+ # '
6+ # ' 1. app tuple list object, which is created via the ``app`` function.
7+ # ' 2. the app name character vector
8+ # ' 3. the workfile path expression, should be in format like: ``app://relpath/to/file.ext``
9+ # ' @param ssid the session id for multiple user environment, default NULL means global user environment
10+ # '
11+ # ' @return the data file path of the required reference file inside this workflow
12+ # '
13+ # ' @details the workfile path expression is in format string of: ``app://filepath``,
14+ # ' example as ``getMzSet://mzset.txt``, where we could parse the reference information
15+ # ' from this character string: app name is ``getMzSet``, and the relpath data is
16+ # ' ``mzset.txt``. so, such configuation could be equals to the function invoke
17+ # ' of the workfile function: ``workfile("getMzSet", "/mzset.txt");``.
18+ # '
19+ const workfile = function (app , relpath = NULL , ssid = NULL , verbose = FALSE ) {
20+ if (is.empty(relpath )) {
21+ if (is.character(app )) {
22+ relpath <- __workfile_uri_parser (app );
23+
24+ # gets the internal workfile reference
25+ # its physical file path
26+ file.path(WorkflowRender :: workspace(relpath $ app , ssid , verbose = verbose ), relpath $ file );
27+ } else {
28+ throw_err(" the given expression value should be an internal workfile path reference!" );
29+ }
30+ } else {
31+ file.path(WorkflowRender :: workspace(app , ssid , verbose = verbose ), relpath );
32+ }
33+ }
0 commit comments