← Back to team overview

kicad-developers team mailing list archive

Re: PATCH: Setting OS X KISYSMOD value in bundle

 

On 1/8/2015 7:53 AM, Adam Wolf wrote:
> I hear what you're saying.
> 
> I don't really like the idea of using environment variables to drive the
> behavior of GUI programs, especially in OS X.  They're tricky in OS X,
> and they're hard to explain to a lot of users.

Environment variables are not ideal but the previous paradigm was
completely broken.  Searching through a long list of paths and hoping
you get the correct footprint (fixed with env variables in Pcbnew)  or
component (still broken in Eeschema) is not the way to go.  Environment
variables also make substituting paths during development very
convenient.  Like virtually any solution, there are always trade offs.

> 
> Fixing this through changing the behavior of how KISYSMOD and probably
> the other environment variables work in Kicad is probably a fair bit of
> work, at least a week or two--when you include developer discussion,
> regression testing on other platforms, stuff like that, probably even
> longer.

I prefer the environment variables so I would be reluctant to remove
them.  The beauty of env variables is you get the best of both worlds.
They can be set at the system level, the user level, or the process
level depending on need.  I think we really need to add a path
management dialog so users can set the local (in process) environment
variables (and other search paths) manually rather than have to define
them at the system or user level.  We should be able to use the install
paths generated by cmake to set the initial env variable values to the
correct location.  The code to handle setting environment variables
while honoring existing variables is already in KiCad.  This is on my
todo list.  I just need to find the time design the dialog and to write
the code to make it all work.  This should make life easier for most
users  and keep at least one developer (me) happy.

> 
> I'm not 100% happy about it, but would something like this be an OK
> stopgap measure while we figure out the right thing moving forward?  I
> am fine only putting this patch in my builds.
> 
> Adam Wolf
> Cofounder and Engineer
> Wayne and Layne
> 
> On Jan 8, 2015 6:26 AM, "Bernhard Stegmaier" <stegmaier@xxxxxxxxxxxxx
> <mailto:stegmaier@xxxxxxxxxxxxx>> wrote:
> 
>     __
> 
>     Hi Adam, hi all,
> 
>     that IMHO could be problematic (depends on what you intend to have).
> 
>     For a single-user environment this might be OK, but it then forces
>     modules to be in a machine specific folder common to all users. In a
>     multi-user environment you probably might not want to have that.
>     And, I never read somewhere that you can override this setting of
>     the bundle somehow, so this could be a once and for all decision (as
>     long as you don't fiddle around with the Info.plist) and you
>     wouldn't need an environment variable at all...
>     Further, I think I tried once to use "~" or "$HOME" in Info.plist
>     but it doesn't expand such variables. So, you obviously can't set
>     the path to something in user home with this method. 
>     Last, I don't know if always any (non-root) user is allowed to write
>     into /Library/Application Support/kicad?
> 
>     In my opinion, the old concept of search paths did fit such
>     hardcoded paths much better than it is currently with environment
>     variables. If environment variables are too hard to set, then
>     probably a configuration setting directly from some "Settings" menu
>     would be better.
> 
>     My opionion: I wouldn't want to have it that way, but since I am the
>     only one using KiCad on my machines I can also live with some links
>     pushing things into the spot I want to have it. 
> 
>     This altogether is somewhat inconsistent, because eeschema will
>     *always* look in <base>/library with <base> being (in that order):
>     * $KICAD
>     * ~/Library/Application Support
>     * /Library/Application Support
>     * <kicad.app>/Contents/SharedSupport 
> 
>     So, if the path should be fixed for pcbnew, I would at least expect
>     eeschema to behave the same way (i.e., removing all the other paths
>     and also pointing it to the one global
>     /Library/Application/Support/kicad/library). 
> 
>      
> 
>     Regards,
>     Bernhard 
> 
>     PS:
> 
>     I just had a brief look at the Apple docs and did see here
> 
>     https://developer.apple.com/library/mac/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/uid/20001431-106825 
> 
>     that obviously the environment set in the Info-plist is only valid
>     when launching via an icon, but not via command-line:
>     <<<
>     These environment variables are set only for apps launched through
>     Launch Services. If you run your executable directly from the
>     command line, these environment variables are not set. 
>     >>>
> 
>     So, another issue that already now with the KIGITHUB variable might
>     lead to confusion...
> 
>      
> 
>      
> 
>     On 2015-01-08 06:52, Adam Wolf wrote:
> 
>>     Hi folks,
>>      
>>     As you may know, it's harder than it seems to set an environment
>>     variable on a bundle in OS X as a user.
>>      
>>     I have a patch here for the OS X bundle that sets KISYSMOD to
>>     /Library/Application Support/kicad/modules
>>      
>>     Please let me know if there are any questions or comments.
>>      
>>     Thanks!
>>      
>>     Adam Wolf
>>     Cofounder and Engineer
>>     W&L
>>
>>     _______________________________________________
>>     Mailing list: https://launchpad.net/~kicad-developers
>>     Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>>     Unsubscribe : https://launchpad.net/~kicad-developers
>>     More help   : https://help.launchpad.net/ListHelp
> 
>     _______________________________________________
>     Mailing list: https://launchpad.net/~kicad-developers
>     Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>     Unsubscribe : https://launchpad.net/~kicad-developers
>     More help   : https://help.launchpad.net/ListHelp
> 
> 
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
> 



References