From: Ethan White Date: Fri, 20 Sep 2013 00:33:17 +0000 (-0400) Subject: Append exports to end of .bash_profile instead of overwriting X-Git-Tag: v0.1~33^2~1 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c5d5414;hp=0e537f70cbecf869f23baf6922d58e8584e328d3;p=swc-setup-windows-installer.git Append exports to end of .bash_profile instead of overwriting In the process at an explanation of where the lines came from so that users know they can remove the lines if desired. --- diff --git a/setup/bin/swc-nano-installer.py b/setup/bin/swc-nano-installer.py index f27aac1..67dd7e8 100644 --- a/setup/bin/swc-nano-installer.py +++ b/setup/bin/swc-nano-installer.py @@ -48,12 +48,13 @@ def make_bash_profile(home_dir, nano_dir): """ nano_path = make_posix_path(nano_dir) - contents = '\n'.join([ - 'export PATH=$PATH:%s' % nano_path, - 'export EDITOR=nano', - '', - ]) - with open(os.path.join(home_dir, '.bash_profile'), 'w') as f: + contents = '\n'.join(['', + '# Add nano to path and set as default editor', + '# Added by the Software Carpentry nano installer', + 'export PATH=$PATH:%s' % nano_path, + 'export EDITOR=nano', + '']) + with open(os.path.join(home_dir, '.bash_profile'), 'a') as f: f.write(contents) def make_posix_path(windows_path):