Subscribe Bookmark RSS Feed

Get path of application?

cis_pete

Community Trekker

Joined:

Jan 26, 2015

Hi,

is there a way to reliably obtain the path of an applicaton (*.jmpapp)? My tests with "get current directory()" and "get default directory()" have not been successful.

As a woraround I created a journal of the application ("save script to journal" in the application builder). This way "get default directory()" gives the path of the journal.

But I fear that this solution is not reliable, for example if you change "Data Files directory" in Preferences.

So is there a better way to get the path of an application?

3 REPLIES
danschikore

Staff

Joined:

Sep 21, 2012

Currently there is no way to directly query the path of a running application.  When deploying an app as an Add-In, what is commonly done is to use the path to the Add-In as a reference point.  The Add-In folder can be found using:

"$ADDIN_HOME(id)"

The id in this case is the unique name given to the Add-In at creation time, such as com.jmp.jmpgeocoder.

cis_pete

Community Trekker

Joined:

Jan 26, 2015

Thanks.

I think I don't necessarily need an application, I probably could achieve the same with a script. Could you query the path of a running script instead?

pmroz

Super User

Joined:

Jun 23, 2011

The best way to do this is to make your .jmpapp file an addin.  Then you can refer to files in the application directory using the $addin_home construct.  For example suppose your addin ID is com.mycompany.dept.mygreatapp.  You could reference files in that addin's location via:

include("$addin_home(com.mycompany.dept.mygreatapp)\myprogram.jsl");