<pre style='margin:0'>
Rainer Müller (raimue) pushed a commit to branch master
in repository macports-base.

</pre>
<p><a href="https://github.com/macports/macports-base/commit/587b720759fb2c5728904a42a150bbe66dc7c555">https://github.com/macports/macports-base/commit/587b720759fb2c5728904a42a150bbe66dc7c555</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit 587b720759fb2c5728904a42a150bbe66dc7c555
</span>Author: Rainer Müller <raimue@macports.org>
AuthorDate: Fri Oct 6 18:09:04 2017 +0200

<span style='display:block; white-space:pre;color:#404040;'>    diagnose: Rework fixing PATH in shell profile
</span>---
 src/macports1.0/diagnose.tcl | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/macports1.0/diagnose.tcl b/src/macports1.0/diagnose.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index 2f83abc..43eea47 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/macports1.0/diagnose.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/macports1.0/diagnose.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -701,20 +701,26 @@ namespace eval diagnose {
</span> 
             # XXX Only works for bash. Should set default profile_path based on the shell.
             if {[info exists macports::ui_options(questions_yesno)] && $shell_name eq "bash"} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                set retval [$macports::ui_options(questions_yesno) "" "DiagnoseFixPATH" "" n 0 "Would you like to add $port_loc/bin to your \$PATH variable now?"]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                ui_msg "MacPorts can also write the required configuration to $profile_path for you."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                set question "Would you like to add $port_loc/bin to your \$PATH variable now?"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                set retval [$macports::ui_options(questions_yesno) $msg "DiagnoseFixPATH" "" n 0 $question]
</span>                 if {$retval == 0} {
                     # XXX: this should use the same paths and comments as the
                     # postflight script of the pkg installer. Maybe they could even
                     # share code?
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    ui_msg "Attempting to add $port_loc/bin to $profile_path"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    ui_debug "Attempting to add $port_loc/bin to $profile_path"
</span> 
                     if {[file exists $profile_path]} {
                         if {[file writable $profile_path]} {
<span style='display:block; white-space:pre;background:#e0ffe0;'>+                            # XXX: Should keep a backup like postflight script does
</span>                             set fd [open $profile_path a]
<span style='display:block; white-space:pre;background:#e0ffe0;'>+                            puts $fd ""
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                            puts $fd "# MacPorts diagnose addition on [clock format $date -format "%Y-%m-%dT%H:%M:%S%z"]"
</span>                             puts $fd "export PATH=$port_loc/bin:$port_loc/sbin:\$PATH"
<span style='display:block; white-space:pre;background:#e0ffe0;'>+                            puts $fd ""
</span>                             close $fd
 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                            ui_msg "Added PATH properly. Please open a new terminal window to load the modified ${profile_path}."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                            ui_msg "Added PATH environment variable to your $shell_name configuration. It is important that you now close this terminal window and then open a new terminal window to load the modified environment from ${profile_path}."
</span>                         } else {
                             ui_error "Can't write to ${profile_path}."
                         }
</pre><pre style='margin:0'>

</pre>