Setting shell working directory for persistent include

16 views
Skip to first unread message

Neil Faiman

unread,
Jul 20, 2020, 6:48:39 PM7/20/20
to BBEdit Talk Mailing List
I'm wondering if there is any way to change the working directory that will be set when I execute a shell script from a persistent include.

At a higher level ...

I have a persistent include script written in Swift. It needs to imp;ort a separately compiled Swift module, which is just a Mac .framework file. The only way that I have been able to tell a Swift script where to find an imported framework is with the -F option on the script command line (or on the shebang line at the top of the script). The easiest way to accomplish that seems to be to put the framework in the project's Templates and Includes directory, along with the script itself. Then I could just put "-F ." on the shebang line. But that only works if "." is the Templates and Includes directory ...

Thanks,

Neil Faiman

Rich Siegel

unread,
Jul 20, 2020, 10:53:05 PM7/20/20
to bbe...@googlegroups.com
On 7/20/20 at 6:48 PM, neil....@faiman.org (Neil Faiman) wrote:

>I have a persistent include script written in Swift. It needs
>to imp;ort a separately compiled Swift module, which is just a
>Mac .framework file. The only way that I have been able to tell
>a Swift script where to find an imported framework is with the
>-F option on the script command line (or on the shebang line at
>the top of the script). The easiest way to accomplish that
>seems to be to put the framework in the project's Templates and
>Includes directory, along with the script itself. Then I could
>just put "-F ." on the shebang line. But that only works if "."
>is the Templates and Includes directory ...

When running a Unix script/executable, the
"BBEditTemplateDirectory" environment variable is set to point
to the "Templates and Includes" directory; or at least it should
be. You can test this with an include that does a `printenv`; if
it works then perhaps you can employ that in your Swift script somehow.

Enjoy,

R.
--
Rich Siegel Bare Bones Software, Inc.
<sie...@barebones.com> <https://www.barebones.com/>

Someday I'll look back on all this and laugh... until they
sedate me.

Reply all
Reply to author
Forward
0 new messages