Ignore:
Timestamp:
Mar 26, 2007, 8:35:37 PM (18 years ago)
Author:
RBRi
Message:

use StringUtilsUnit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/NewView/StartupUnit.pas

    r82 r103  
    2525// Look for any items that are actually specifiying environment
    2626// variables, and expand them to the contents of the variables
    27 Procedure TranslateIPFEnvironmentVars( Items: TStrings;
    28                                        ExpandedItems: TStrings );
     27Procedure TranslateIPFEnvironmentVars(const Items: TStrings; ExpandedItems: TStrings );
    2928
    3029// Given a filename, which may or may not contain a path or extension,
     
    4746  DebugUnit,
    4847  PMWin,
    49   ACLStringUtility,
    5048  HelpManagerUnit,
     49  StringUtilsUnit,
    5150  FileUtilsUnit;
    5251
    5352// Look for any items that are actually specifiying environment
    5453// variables, and expand them to the contents of the variables
    55 Procedure TranslateIPFEnvironmentVars( Items: TStrings;
    56                                        ExpandedItems: TStrings );
     54Procedure TranslateIPFEnvironmentVars(const Items: TStrings; ExpandedItems: TStrings );
    5755var
    58   i: longint;
    59   Item: string;
    60   EnvironmentVarValue: string;
     56  i : longint;
     57  tmpItem: string;
     58  tmpEnvironmentVarValue: string;
    6159begin
    6260  LogEvent(LogStartup, 'Translating environment vars' );
    6361  for i := 0 to Items.Count - 1 do
    6462  begin
    65     Item := Items[ i ];
     63    tmpItem := Items[ i ];
    6664
    67     Item := StrUnQuote( Item ); // remove single quotes
    68     Item := StrUnDoubleQuote( Item ); // remove double quotes
     65    tmpItem := StrTrimChars(tmpItem, [Quote]); // remove single quotes
     66    tmpItem := StrTrimChars(tmpItem, [DoubleQuote]); // remove double quotes
    6967
    70     LogEvent(LogStartup, '  Item: ' + Item );
    71     EnvironmentVarValue := GetEnv( Uppercase( Item ) );
     68    LogEvent(LogStartup, '  Checking for environment var: ' + tmpItem );
     69    tmpEnvironmentVarValue := GetEnv( Uppercase( tmpItem ) );
    7270    if DosError = 0 then
    7371    begin
    7472      // environment var exists - use it's value
    75       LogEvent(LogStartup, '    Translated: ' + EnvironmentVarValue );
    76       while EnvironmentVarValue <> '' do
    77       begin
    78          Item := ExtractNextValue( EnvironmentVarValue, '+' );
    79          ExpandedItems.Add( Item );
    80       end;
     73      LogEvent(LogStartup, '    Environment var found; translated to: ' + tmpEnvironmentVarValue);
     74      StrExtractStrings(ExpandedItems, tmpEnvironmentVarValue, ['+'], #0);
    8175    end
    8276    else
    8377    begin
    8478      // not an environment var
    85       ExpandedItems.Add( Item );
     79      ExpandedItems.Add( tmpItem );
    8680    end;
    8781  end;
Note: See TracChangeset for help on using the changeset viewer.