Ignore:
Timestamp:
Jun 1, 2009, 2:42:16 PM (16 years ago)
Author:
RBRi
Message:

index is a real object now
support for env variables to make glossary simulation work

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/NewView/CmdLineParameterUnit.pas

    r259 r342  
    8686  end;
    8787
     88
     89  // add all file name parts of aFileNameString to the result
     90  // check for containing environment vars
     91  // and include all help files if the environment var points
     92  // to a directory
     93  PROCEDURE ParseAndExpandFileNames(const aFileNameString: String; aResult: TStrings );
     94
     95
    8896  // returns a string containing the whole
    8997  // command line parametes
     
    680688
    681689
     690  PROCEDURE ParseAndExpandFileNames(const aFileNameString : String; aResult: TStrings);
     691  var
     692    i : longint;
     693    tmpFileNamesList: TStringList;
     694    tmpItem: String;
     695    tmpEnvironmentVarValue: string;
     696  begin
     697    LogEvent(LogDebug, 'ParseAndExpandFileNames "' + aFileNameString + '"');
     698
     699    tmpFileNamesList := TStringList.Create;
     700
     701    StrExtractStrings(tmpFileNamesList, aFileNameString, [HELP_FILE_DELIMITER, PATH_SEPARATOR], #0);
     702    for i := 0 to tmpFileNamesList.Count - 1 do
     703    begin
     704      tmpItem := tmpFileNamesList[i];
     705
     706      // is this a environment var
     707      tmpEnvironmentVarValue := GetEnv(tmpItem);
     708      if DosError = 0 then
     709      begin
     710        // environment var exists
     711        LogEvent(LogStartup, '    Environment var found; translated to: "' + tmpEnvironmentVarValue + '"');
     712        ParseAndExpandFileNames(tmpEnvironmentVarValue, aResult);
     713      end
     714      else if DirectoryExists(tmpItem) then
     715      begin
     716        ListFilesInDirectory(tmpItem, '*' + HELP_FILE_EXTENSION, true, aResult);
     717      end
     718      else
     719      begin
     720        aResult.Add(tmpItem);
     721      end;
     722    end;
     723
     724    tmpFileNamesList.Destroy;
     725  end;
     726
     727
    682728  FUNCTION nativeOS2GetCmdLineParameter : AnsiString;
    683729  VAR
Note: See TracChangeset for help on using the changeset viewer.