I would put all scripts into tgsjo.ijs so that this just needs: load 'zerowords/tgjsgo'
But if you want several scripts, you could load them without needing tgsjopath like: load 'zerowords/tgsjo/tgsjoalias' The function tgsjopath extracts the full filename from 4!:3. Alternatively, J itself uses getscripts_j_, for example: >getscripts_j_ 'zerowords/tgsjo zerowords/tgsjo/tgsjoalias' /home/chris/uni/j9/addons/zerowords/tgsjo/tgsjo.ijs /home/chris/uni/j9/addons/zerowords/tgsjo/tgsjoalias.ijs On Mon, May 30, 2022 at 10:18 AM Jinwoo Lee <[email protected]> wrote: > Yeah, it'd work to add my own folder to UserFolders for a specific path. > But I'd like to have a general solution that can be used in any files. > > Raul's solution seems to solve the problem. > > Thanks! > Jinwoo > > > On Mon, May 30, 2022 at 9:48 AM chris burke <[email protected]> wrote: > > > Perhaps I misunderstand, but it looks like ~filefolder is that described > in > > https://code.jsoftware.com/wiki/Guides/Folders_and_Projects . > > > > Note that folders can be defined on the fly, e.g. you could run > > > > UserFolders_j_=: UserFolders_j_,'filefolder';'/my/path' > > > > and then: > > > > jpath'~filefolder' > > /my/path > > > > On Mon, May 30, 2022 at 8:58 AM Jinwoo Lee <[email protected]> wrote: > > > > > When my script file loads other files that I write, it would be very > > > convenient if we had a special jpath syntax for the folder that > contains > > > the current file. For example, let's say my script is at > > /my/path/foo.ijs, > > > and it loads bar.ijs from the same folder. > > > > > > load 'bar.ijs' > > > ... > > > > > > Or it loads baz.ijs from a subfolder. > > > > > > load 'libs/baz.ijs' > > > ... > > > > > > But this works only when I run the script from the /my/path folder. If > I > > > run it from, say, my home directory, load would fail to locate bar.ijs. > > > > > > If J provides a special path syntax, say, '~filefolder', I'll be able > to > > do > > > > > > load '~filefolder/bar.ijs' > > > ... > > > > > > or > > > > > > load '~filefolder/libs/baz.ijs' > > > ... > > > > > > I'll be able to use ARGV_z_ to extract it but that would work only for > > the > > > main script file. > > > > > > Does this make sense? Or am I missing something obvious? > > > > > > Cheers, > > > Jinwoo > > > ---------------------------------------------------------------------- > > > For information about J forums see http://www.jsoftware.com/forums.htm > > > > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
