I want to know a function that returns /fullpath_to_project/products/ when I call it from the script "products/product.tex". And I want it to return /fullpath_to_project/products/product/ when I call it from the script "products/product/article.tex".
Finally found it, after lots of trial-and-erroring through
likely-looking table names in file-job.lua: the stack of input files
is kept in resolvers.inputstack. Assuming (absolute path of invocation
dir) + (path of file relative to invocation dir) = the desired path,
the following should work.
\cldcontext{
environment.runpath .. '/' ..
file.pathpart(resolvers.inputstack[#resolvers.inputstack])
}
You may or may not want to parse out any ./ and ../ components.
(If you do: helpful filename manipulation functions (such as
file.pathpart, indeed) may be found in l-file.lua.)
Hope this helps,
Sietse
On Fri, Sep 28, 2012 at 12:38 AM, Andre Caldas
Thank you for yor time, Peter. But this is not what I wanted... :-(
Is there a way to know the directory of the currently being processed source file?
This works with mkiv:
\starttext PWD: \cldcontext{io.popen"pwd":read()} \stoptext
This gives the directory where the "context" command was called from. I want the directory where the "tex" file being processed lives in.
For example, I have a component products/product/article.tex Inside a product products/product.tex I produce it by calling context products/product.tex
Cheers, André Caldas. ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________