I’m working on a script that runs a unix executable that is included in the Resources folder of the script bundle; it runs the unix executable from a shell script. This executable has some dependencies to libraries that may not be on the user’s system. I don’t want to ask the user (who may not have administrative privileges) to install the libraries on his or her system, so I want to include the libraries in the script bundle itself.
For this to work correctly, I need to change the unix path temporarily so that it begins with the Resources directory in the bundle, and then run the unix executable. I already know the POSIX path to the unix executable, because I put it into a variable earlier in the script. Is there a way to “do shell script” that will add the folder to the path and then run the command?
At the moment the shell script looks something like this:
do shell script POSIX_path_to_resources_folder & "\myunixcmd " & file_to_modify
What I think I need to do is add a command on the same line that adds POSIX_path_to_resources_folder to the unix path.
This may not work though as library locations are usually not part of your path but hardcoded into the binaries. Your best bet would be to find a different version of the command (or build one yourself) with the static library built into it.
Thank you for that. You’re exactly right that the PATH setting didn’t work in this instance - the path to the libraries is hardcoded into the binaries of libwpd 0.9.0.
I have the minimal knowledge needed to compile the binaries in their default form - now it’s time for me to learn how to build one with the libraries built-in. A standalone binary like that exists for a much older version, but the person who built it seems to have turned to other projects since. I’ll take a deep breath and start learning.