ofek / userpath

Cross-platform tool for adding locations to the user PATH, no elevated privileges required!
MIT License
151 stars 20 forks source link

Do not create .bash_profile if it does not exist #19

Closed potentialize closed 3 years ago

potentialize commented 4 years ago

I was installing gdbgui, which mentions your program in its installation instructions (https://www.gdbgui.com/installation/). After that, my terminal lost color.

Turns out your program created a .bash_profile file to add the path, thus my .bashrc (which sets the colors) was not sourced anymore. (https://askubuntu.com/a/608096) The path was also set in .bashrc, which is fine. I am using Raspbian.

Please do not create config files if they do not already exist, as that may break others configuration.

AlJohri commented 4 years ago

I wrote up a comment that basically asks for this same behavior: https://github.com/ofek/userpath/issues/3#issuecomment-512973913

Excerpt:

profile/bash_profile means use whichever file already exists, defaulting to bash_profile

jwodder commented 3 years ago

I just ran into the same problem, with the added wrinkle that I already have a ~/.profile file but no ~/.bash_profile. userpath should use ~/.profile in such a situation.

itsayellow commented 3 years ago

Currently the logic of the code seems to only not create a .bash_profile file if the system is ubuntu. https://github.com/ofek/userpath/blob/fb29f5a7049d9bc84729d2c2b5a893253e1d8eaa/userpath/shells.py#L39-L41