[Jprogramming] Path of source file?

Sprague, Webb (OFM) Webb.Sprague at ofm.wa.gov
Thu Apr 8 05:51:36 HKT 2010


Hi all,

Is there a way to return the path of where a program file is stored such
that I can reference that path inside the program?  

For example, if I have a program stored in C:\STUFF\foo.ijs, I would
like to be able to say "sourcepath=.<J MAGIC HERE>" and then later "load
(sourcepath,bar.ijs)" in order to load a program that is stored in the
same directory.

If there are any Matlab hackers here, the analogous command would be
"mfilename", though one has to call "fileparts" to parse the path out of
the full filename.

I don't want the "current working directory", since that can change
depending on from where the interpreter is being run (and I asked for
this particular thing earlier).

Thanks!


More information about the Programming mailing list