Changeset 118


Ignore:
Timestamp:
Aug 15, 2006, 1:36:11 PM (19 years ago)
Author:
dmik
Message:

configure.cmd: Fixed: adding paths to envirionment variables could sometimes produce duplicates which led to the 'Command line too long' error message.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure.cmd

    r97 r118  
    414414    call lineout G.!QtCmd, '        if (wordpos(''debug'', line, 3) > 0) then DEBUG = 1'
    415415    call lineout G.!QtCmd, 'end'
     416    call lineout G.!QtCmd, 'call lineout QTDIR''\.qtos2config'''
    416417    call lineout G.!QtCmd, ''
    417418    call lineout G.!QtCmd, '/* parse command line */'
     
    437438    call lineout G.!QtCmd, 'if (\DEBUG) then do'
    438439    call lineout G.!QtCmd, '    /* releae versions come first */'
    439     call lineout G.!QtCmd, '    call AddPathEnv ''PATH'', QTDIR''\bin'''
    440     call lineout G.!QtCmd, '    call AddPathEnv ''PATH'', QTDIR''\bin\debug'''
    441     call lineout G.!QtCmd, '    call AddPathEnv ''BEGINLIBPATH'', QTDIR''\bin'''
    442     call lineout G.!QtCmd, '    call AddPathEnv ''BEGINLIBPATH'', QTDIR''\bin\debug'''
     440    call lineout G.!QtCmd, '    call AddPathEnv ''PATH'', QTDIR''\bin'', ''A'''
     441    call lineout G.!QtCmd, '    call AddPathEnv ''PATH'', QTDIR''\bin\debug'', ''A'''
     442    call lineout G.!QtCmd, '    call AddPathEnv ''BEGINLIBPATH'', QTDIR''\bin'', ''A'''
     443    call lineout G.!QtCmd, '    call AddPathEnv ''BEGINLIBPATH'', QTDIR''\bin\debug'', ''A'''
    443444    call lineout G.!QtCmd, 'end'
    444445    call lineout G.!QtCmd, 'else do'
    445446    call lineout G.!QtCmd, '    /* debug versions come first */'
    446     call lineout G.!QtCmd, '    call AddPathEnv ''PATH'', QTDIR''\bin\debug'''
    447     call lineout G.!QtCmd, '    call AddPathEnv ''PATH'', QTDIR''\bin'''
    448     call lineout G.!QtCmd, '    call AddPathEnv ''BEGINLIBPATH'', QTDIR''\bin\debug'''
    449     call lineout G.!QtCmd, '    call AddPathEnv ''BEGINLIBPATH'', QTDIR''\bin'''
     447    call lineout G.!QtCmd, '    call AddPathEnv ''PATH'', QTDIR''\bin\debug'', ''A'''
     448    call lineout G.!QtCmd, '    call AddPathEnv ''PATH'', QTDIR''\bin'', ''A'''
     449    call lineout G.!QtCmd, '    call AddPathEnv ''BEGINLIBPATH'', QTDIR''\bin\debug'', ''A'''
     450    call lineout G.!QtCmd, '    call AddPathEnv ''BEGINLIBPATH'', QTDIR''\bin'', ''A'''
    450451    call lineout G.!QtCmd, 'end'
    451452    call lineout G.!QtCmd, ''
     
    516517        parse var paths path';'paths
    517518        if (path \== '') then
    518             call AddPathVar 'G.!temp', path, 1
     519            call AddPathVar 'G.!temp', path, 'P'
    519520    end
    520521    /* second pass: generate AddPathEnv calls */
     
    523524        parse var paths path';'paths
    524525        if (path \== '') then
    525             call lineout G.!QtCmd, 'call AddPathEnv '''env''','''QuotePath(path)''', 1'
     526            call lineout G.!QtCmd, 'call AddPathEnv '''env''','''QuotePath(path)''', ''P'''
    526527    end
    527528    return
     
    968969    parse arg path
    969970    path = FixDirNoSlash(path)
    970     call AddPathEnv 'PATH', Opt.!ILINKPath.!addPath, 1
    971     call AddPathEnv 'BEGINLIBPATH', Opt.!ILINKPath.!addLibPath, 1
     971    call AddPathEnv 'PATH', Opt.!ILINKPath.!addPath, '''P'''
     972    call AddPathEnv 'BEGINLIBPATH', Opt.!ILINKPath.!addLibPath, '''P'''
    972973    address 'cmd' 'ilink.exe | more'
    973974    say
     
    10031004    parse arg path
    10041005    path = FixDirNoSlash(path)
    1005     call AddPathEnv 'PATH', Opt.!GNUMakePath.!addPath, 1
    1006     call AddPathEnv 'BEGINLIBPATH', Opt.!GNUMakePath.!addLibPath, 1
     1006    call AddPathEnv 'PATH', Opt.!GNUMakePath.!addPath, '''P'''
     1007    call AddPathEnv 'BEGINLIBPATH', Opt.!GNUMakePath.!addLibPath, '''P'''
    10071008    address 'cmd' 'make.exe --version | more'
    10081009    say
     
    16311632 *  Adds the given path to the contents of the given variable
    16321633 *  containing a list of paths separated by semicolons.
    1633  *  This function guarantees that the given path is contained only once
    1634  *  in the variable.
     1634 *  This function guarantees that if the given path is already contained in the
     1635 *  variable, the number of occurences will not increase (but the order may be
     1636 *  rearranged depending on the mode argument).
    16351637 *
    16361638 *  @param  name        variable name
    16371639 *  @param  path        path to add
    1638  *  @param  prepend     1 will put the path to the beginning, otherwise it
    1639  *                      will be appended to the end of the variable's contents.
     1640 *  @param  mode        'P' (prepend): remove the old occurence of path (if any)
     1641 *                          and put it to the beginning of the variable's contents
     1642 *                      'A' (append): remove the old occurence of path (if any)
     1643 *                          and put it to the end of the variable's contents
     1644 *                      otherwise: append path to the variable only if it's
     1645 *                          not already contained there
    16401646 *  @param  environment either '' to act on REXX variables or 'OS2ENVIRONMENT'
    16411647 *                      to act on OS/2 environment variables
    16421648 *
    1643  *  @version 1.0
     1649 *  @version 1.1
    16441650 */
    16451651/* <<< export to qt.cmd starts */
    16461652AddPathVar: procedure expose (Globals)
    1647     parse arg name, path, prepend, environment
     1653    parse arg name, path, mode, environment
    16481654    if (path == '') then return
    16491655    if (verify(path, ' +', 'M') > 0) then path = '"'path'"'
    1650     prepend = (prepend == 1)
     1656    mode = translate(mode)
     1657    prepend = (mode == 'P') /* strictly prepend */
     1658    append = (mode == 'A') /* strictly append */
    16511659    os2Env = (translate(environment) == 'OS2ENVIRONMENT')
    16521660    if (os2Env) then do
     
    16561664    end
    16571665    else cur = value(name)
     1666    /* locate the previous occurence of path */
    16581667    l = length(path)
    1659     p = pos(translate(path), translate(cur))
    1660     cb = ''; ca = ''
    1661     found = (p > 0)
    1662     if (found) then do
     1668    found = 0; p = 1
     1669    pathUpper = translate(path)
     1670    curUpper = translate(cur)
     1671    do while (\found)
     1672        p = pos(pathUpper, curUpper, p)
     1673        if (p == 0) then leave
     1674        cb = ''; ca = ''
    16631675        if (p > 1) then cb = substr(cur, p - 1, 1)
    16641676        if (p + l <= length(cur)) then ca = substr(cur, p + l, 1)
    16651677        found = (cb == '' | cb == ';') & (ca == '' | ca == ';')
     1678        if (\found) then p = p + 1
    16661679    end
    16671680    if (found) then do
    1668         if (\prepend) then return
    1669         if (ca == ';') then l = l + 1
    1670         cur = delstr(cur, p, l)
    1671     end
    1672     if (prepend) then do
    1673         if (left(cur, 1) \== ';') then cur = ';'cur
    1674         cur = path||cur
    1675     end
    1676     else do
    1677         if (cur \== '' & right(cur, 1) \== ';') then cur = cur';'
    1678         cur = cur||path
     1681        /* remove the old occurence when in strict P or A mode */
     1682        if (prepend | append) then cur = delstr(cur, p, l)
     1683    end
     1684    /* add path when necessary */
     1685    if (prepend) then cur = path';'cur
     1686    else if (append | \found) then cur = cur';'path
     1687    /* remove excessive semicolons */
     1688    cur = strip(cur, 'B', ';')
     1689    p = 1
     1690    do forever
     1691        p = pos(';;', cur, p)
     1692        if (p == 0) then leave
     1693        cur = delstr(cur, p, 1)
    16791694    end
    16801695    if (os2Env) then do
Note: See TracChangeset for help on using the changeset viewer.