Giter Club home page Giter Club logo

Comments (5)

wanglongqi avatar wanglongqi commented on June 24, 2024

@jamiek Thanks for the information provided. You are absolutely right. Previously, I simply symbol link all the required programs to Applications/Inkscape.app/Contents/Resources/bin.

App launching from .app bundle does not use the same shell as Terminal. In the case where default shell for user is bash, the variable may be set in .bash_profile and several other places. I do not know whether there is a proper way to set the shell used to launch .app bundle, or to load user's PATH settings of the default shell used in Terminal. Any idea?

from writetex.

jamiek avatar jamiek commented on June 24, 2024

@wanglongqi I've done some digging and have some more info.

So when launched from the Finder by double clicking an .app bundle the path is set by launchd which has the default PATH of /usr/bin:/bin:/usr/sbin:/sbin apprently prepended by predefined locations inside the bundle (e.g. /Applications/Inkscape.app/Contents/MacOS:/Applications/Inkscape.app/Contents/MacOS/../Resources/bin)

launchctl can be used to modify the default PATH, but note that this updates the PATH for ALL apps launched via the finder.
sudo launchctl config user path /usr/bin:/bin:/usr/sbin:/usr/local/bin:/Library/TeX/texbin
followed by a reboot has added the locations of pdflatex and pdf2svg to the PATH seen by processes spawned by inkscape. The extension runs fine after doing this and is indeed seeing the updated PATH /Applications/Inkscape.app/Contents/MacOS:/Applications/Inkscape.app/Contents/MacOS/../Resources/bin:/usr/bin:/bin:/usr/sbin:/usr/local/bin:/Library/TeX/texbin

I will caution that the launchctl command above will overwrite any previously set custom PATH for launchd. This can be addressed by using launchctl getenv PATH to get the existing path and then append the locations for pdflatex etc.

This seems like a reasonable solution but my only hesitation is that it affects all apps launched via the finder. That said, these apps tend to look inside the .app bundle first so this should't risk breaking things.

An alternative might be to try to use python to set the appropriate PATH using os.environ and try to read the path from the "usual" locations, or read from a writeTex configuration file.

One other possibility is to modify the info.plist file in the .app bundle to include the updated PATH. i've tested this and it works, but requires a restart.

from writetex.

wanglongqi avatar wanglongqi commented on June 24, 2024

Maybe another way is to add a text field for user to set additional search paths. Inkscape will remember the field value used for last run, so user also only need to set that field once.

from writetex.

jamiek avatar jamiek commented on June 24, 2024

User configurable text fields sounds like a clean way to handle it. Especially if you could put the config settings on a separate tab. It would keep the UI looking clean.

from writetex.

wanglongqi avatar wanglongqi commented on June 24, 2024

I tried to add a settings tab in this commit 85458b1, when have time please help do some tests.

screenshot

from writetex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.