Diff
Not logged in

Differences From Artifact [e16964f6f4]:

To Artifact [5d14cdcdbb]:


95
96
97
98
99
100
101





102
103
104
105
106
107
108
109
110
111
112
113


















114
115
116
117
118
119
120
    #       use of this procedure should be rare; however, in practice, this
    #       procedure is actually used quite a bit (e.g. by the test suite).
    #
    return [expr {[info exists ::tcl_platform(platform)] && \
        $::tcl_platform(platform) eq "windows"}]
  }






  #
  # NOTE: This procedure should return non-zero if and only if only there
  #       is currently an interactive user that can respond to prompts and
  #       other requests for input.
  #
  proc isInteractive {} {
    #
    # TODO: Is something more complex required here?
    #
    return [expr {[info exists ::tcl_interactive] && \
        [string is true -strict $::tcl_interactive]}]
  }



















  #
  # NOTE: This procedure adds the specified directory to the PATH.  It is
  #       designed to work on the various flavors of Windows and Unix.
  #
  proc addToPath { dir } {
    global env







>
>
>
>
>












>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
    #       use of this procedure should be rare; however, in practice, this
    #       procedure is actually used quite a bit (e.g. by the test suite).
    #
    return [expr {[info exists ::tcl_platform(platform)] && \
        $::tcl_platform(platform) eq "windows"}]
  }

  proc isMacOS {} {
    return [expr {[info exists ::tcl_platform(os)] && \
        $::tcl_platform(os) eq "Darwin"}]
  }

  #
  # NOTE: This procedure should return non-zero if and only if only there
  #       is currently an interactive user that can respond to prompts and
  #       other requests for input.
  #
  proc isInteractive {} {
    #
    # TODO: Is something more complex required here?
    #
    return [expr {[info exists ::tcl_interactive] && \
        [string is true -strict $::tcl_interactive]}]
  }

  proc foundInPath { dirs dir } {
    if {[isWindows]} then {
      #
      # HACK: Causes shimmering of "$dirs" list representation.  Must use
      #       [string tolower] here anyhow because Tcl 8.4 lacks -nocase
      #       option for [lsearch] (please see TIP #241).
      #
      set dirs [string tolower $dirs]
      set dir [string tolower $dir]
    }

    if {[lsearch -exact $dirs $dir] != -1} then {
      return true
    } else {
      return false
    }
  }

  #
  # NOTE: This procedure adds the specified directory to the PATH.  It is
  #       designed to work on the various flavors of Windows and Unix.
  #
  proc addToPath { dir } {
    global env
128
129
130
131
132
133
134


135
136
137
138
139
140
141

    #
    # NOTE: On Windows, use PATH; otherwise (i.e. Unix), use
    #       LD_LIBRARY_PATH.
    #
    if {[isWindows]} then {
      set name PATH


    } else {
      set name LD_LIBRARY_PATH
    }

    #
    # NOTE: Make sure the directory is not already in the
    #       loader search path.







>
>







151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166

    #
    # NOTE: On Windows, use PATH; otherwise (i.e. Unix), use
    #       LD_LIBRARY_PATH.
    #
    if {[isWindows]} then {
      set name PATH
    } elseif {[isMacOS]} then {
      set name DYLD_LIBRARY_PATH
    } else {
      set name LD_LIBRARY_PATH
    }

    #
    # NOTE: Make sure the directory is not already in the
    #       loader search path.
154
155
156
157
158
159
160
161

162
163
164
165
166
167
168
169
170
    if {[info exists env($name)]} then {
      #
      # NOTE: Grab the value of the environment variable.
      #
      set value $env($name)

      #
      # BUGBUG: Consider exact case only for now.

      #
      if {[lsearch -exact [split $value $separator] $dir] == -1} then {
        #
        # NOTE: Append the directory to the loader search path.
        #       This allows us to subsequently load DLLs that
        #       implicitly attempt to load other DLLs that are
        #       not in the application directory.
        #
        set env($name) [join [list $value $dir] $separator]







|
>

|







179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
    if {[info exists env($name)]} then {
      #
      # NOTE: Grab the value of the environment variable.
      #
      set value $env($name)

      #
      # NOTE: Check if the directory is already present in the
      #       list from the environment.
      #
      if {![foundInPath [split $value $separator] $dir]} then {
        #
        # NOTE: Append the directory to the loader search path.
        #       This allows us to subsequently load DLLs that
        #       implicitly attempt to load other DLLs that are
        #       not in the application directory.
        #
        set env($name) [join [list $value $dir] $separator]