I still don't really know how projects work, but I hope that this is a good 
general crossplatform solution

this line can go at the top of any script in order to set MYDIR_base_ to the 
same folder as the file it is defined in.  If the line appears inside a locale 
then MYDIR_locale_ would be set.

1!:44 MYDIR =: getpath_j_  '\/' rplc~ > (4!:4<'thisfile'){(4!:3)  thisfile=:''

1!:44 will set the current working directory.  Doing so lets you 
open/load/require files (in this folder) without path qualification.  Not using 
1!:44, would let you open with MYDIR , filename or paths relative to MYDIR.

the '/\' rplc~ part is for windows, which deals with \ deliminated paths ok, 
but 4!:3 still returns / separated.

Hopefully this works on all OS's


----- Original Message -----
From: Neill Robson <[email protected]>
To: [email protected]
Cc: 
Sent: Monday, April 27, 2015 11:31 AM
Subject: [Jprogramming] Ability to query the current project directory

I'm trying to write a user-defined shortcut in j803 that works similarly to
F9 (run) and Ctrl+F9 (build), in that it runs the appropriately-named
script within the current project folder.

Is there any way one can query the IDE to return the open project's root
directory to create user-defined operations like this? I've been told that
this was easier in the older IDEs written in J, but given that j803's
interface is written in C the task will be considerably harder.

Any thoughts?

-- 
-Neill

-- 


*This message originated from Raleigh Charter High School, a public charter 
school in Raleigh. All e-mail correspondence to and from this address is 
subject to the North Carolina Public Records Law as defined under N.C.G.S. 
ยง132.1, which may result in monitoring or disclosure to third parties, 
including law enforcement.*
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to