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 <cbu...@jsoftware.com> 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 <jinwo...@gmail.com> 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

Reply via email to