Changeset 208 for trunk/installer


Ignore:
Timestamp:
Jun 11, 2007, 8:47:50 PM (18 years ago)
Author:
RBRi
Message:

library updates

Location:
trunk/installer
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/installer/ChooseFolderFormUnit.pas

    r144 r208  
    88
    99Uses
    10   Classes, Forms, Graphics, Buttons, CustomFileControls, StdCtrls;
     10  Classes,
     11  Forms,
     12  Graphics,
     13  Buttons,
     14  CustomFileControls,
     15  StdCtrls;
    1116
    1217Type
  • trunk/installer/MainFormUnit.pas

    r144 r208  
    88
    99Uses
    10   OS2Def, PmWin,
    11   Classes, Forms, Graphics, ExtCtrls, Buttons, StdCtrls, TabCtrls, ComCtrls;
     10  OS2Def,
     11  PmWin,
     12  Classes,
     13  Forms,
     14  Graphics,
     15  ExtCtrls,
     16  Buttons,
     17  StdCtrls,
     18  TabCtrls,
     19  ComCtrls;
    1220
    1321Const
     
    159167
    160168uses
    161   BseDos, BseErr, PmWp, PmShl, PmErr,
    162   SysUtils, Dos, Dialogs,
    163   ACLUtility, ACLFileUtility, ACLStringUtility, ACLDialogs,
     169  BseDos,
     170  BseErr,
     171  PmWp,
     172  PmShl,
     173  PmErr,
     174  SysUtils,
     175  Dos,
     176  Dialogs,
     177  ACLUtility,
     178  ACLDialogs,
    164179  ControlsUtility,
    165   ChooseFolderFormUnit;
     180  ChooseFolderFormUnit,
     181  FileUtilsUnit,
     182  CharUtilsUnit,
     183  StringUtilsUnit;
    166184
    167185{$R NewViewInstall}
     
    386404  // make sure it ends in a backslash
    387405  if Result <> '' then
    388     Result := AddSlash( Result );
     406    Result := AddDirectorySeparator( Result );
    389407end;
    390408
     
    393411  FSourceDir := GetApplicationDir;
    394412
    395   FSystemDir := GetBootDrive
    396                 + ':\os2\';
    397   FSystemDLLDir := FSystemDir
    398                    + 'dll\';
     413  FSystemDir := GetBootDriveLetter + ':\os2\';
     414  FSystemDLLDir := FSystemDir + 'dll\';
    399415
    400416  // ecs things
     
    411427
    412428  if FEnv_Programs <> '' then
    413     InstallFolderEdit.Text := AddSlash( FEnv_Programs )
    414                                + 'NewView'
     429    InstallFolderEdit.Text := AddDirectorySeparator(FEnv_Programs) + 'NewView'
    415430  else
    416     InstallFolderEdit.Text := GetBootDrive + ':\NewView';
     431    InstallFolderEdit.Text := GetBootDriveLetter + ':\NewView';
    417432
    418433  CreateIconCheckBox.Checked := true;
     
    499514    begin
    500515      DoErrorDlg( 'Installation Error',
    501                   'The file ' + EndLine
    502                   + ' ' + DestinationPath + EndLine
     516                  'The file ' + StrCRLF
     517                  + ' ' + DestinationPath + StrCRLF
    503518                  + 'is read-only and cannot be replaced.' );
    504519      exit;
     
    530545        // But that's overkill for NewView
    531546        DoErrorDlg( 'Installation Error',
    532                     'This file is in use: ' + EndLine
    533                     + ' ' + DestinationPath + EndLine
     547                    'This file is in use: ' + StrCRLF
     548                    + ' ' + DestinationPath + StrCRLF
    534549                    + 'and cannot be replaced.' );
    535550        exit;
     
    545560        // error
    546561        DoErrorDlg( 'Install Error',
    547                     'Could not unlock ' + EndLine
    548                     + ' ' + DestinationPath + EndLine
     562                    'Could not unlock ' + StrCRLF
     563                    + ' ' + DestinationPath + StrCRLF
    549564                    + SysErrorMessage( rc ) );
    550565
     
    555570    begin
    556571      DoErrorDlg( 'Install Error',
    557                   'Unable to acces ' + Endline
    558                   + ' ' + DestinationPath + EndLine
     572                  'Unable to acces ' + StrCRLF
     573                  + ' ' + DestinationPath + StrCRLF
    559574                  + SysErrorMessage( rc ) );
    560575      exit;
     
    575590          // error
    576591          DoErrorDlg( 'Install Error',
    577                       'Could not backup ' + EndLine
    578                       + ' ' + DestinationPath + EndLine
    579                       + ' to' + EndLine
    580                       + ' ' + Backup + EndLine
    581                       + EndLine
     592                      'Could not backup ' + StrCRLF
     593                      + ' ' + DestinationPath + StrCRLF
     594                      + ' to' + StrCRLF
     595                      + ' ' + Backup + StrCRLF
     596                      + StrCRLF
    582597                      + SysErrorMessage( rc ) );
    583598          exit;
     
    595610    // error
    596611    DoErrorDlg( 'Install Error',
    597                 'Could not copy new file ' + EndLine
    598                 + ' ' + SourcePath + EndLine
    599                 + ' to' + EndLine
    600                 + ' ' + DestinationPath + EndLine
    601                 + EndLine
     612                'Could not copy new file ' + StrCRLF
     613                + ' ' + SourcePath + StrCRLF
     614                + ' to' + StrCRLF
     615                + ' ' + DestinationPath + StrCRLF
     616                + StrCRLF
    602617                + SysErrorMessage( rc ) );
    603618    exit;
     
    618633
    619634  Files := TStringList.Create;
    620   ListDirectory( FSourceDir,
     635  ListFilesInDirectory( FSourceDir,
    621636                 Filter,
    622                  Files,
    623                  nil ); // don't need subdirs
     637                 false, // don't need subdirs
     638                 Files); // don't need subdirs
    624639
    625640  for i := 0 to Files.Count - 1 do
     
    678693      // work out remaining length of buffer
    679694      // so we don't overrun it if the data is invalid, ie. non terminated
    680       RemainingLength := PCharDiff( pHandleListData + HandleListSize,
     695      RemainingLength := PCharPointerDiff( pHandleListData + HandleListSize,
    681696                                    pHandleString );
    682       HandleString := StrNPas( pHandleString, RemainingLength );
     697      HandleString := StrPasWithLength( pHandleString, RemainingLength );
    683698
    684699      // convert to integer object handle
     
    740755  inc( pHandleString );
    741756
    742   ActualLength := PCharDiff( pHandleString, pHandleListData );
     757  ActualLength := PCharPointerDiff( pHandleString, pHandleListData );
    743758  result := PrfWriteProfileData( HINI_USER,
    744759                                 FilterAssociationsKey,
     
    786801// association one of more file filters,
    787802// separated by commas, with the given object
    788 function MakeDefaultAssociations( const Mask: string;
     803function MakeDefaultAssociations( const aMask: string;
    789804                                  hDesktopObject: HOBJECT ): boolean;
    790805var
    791   Filter: string;
    792   RemainingMask: string;
     806  tmpMask : String;
     807  tmpMasks : TStringList;
     808  i : longint;
    793809begin
    794810  Result := false;
    795   RemainingMask := Mask;
    796   while RemainingMask <> '' do
    797   begin
    798     Filter := ExtractNextValue( RemainingMask, ',' );
    799     if not MakeDefaultAssociation( Filter, hDesktopObject ) then
    800       exit;
    801   end;
     811
     812  tmpMasks := TStringList.Create;
     813  StrExtractStrings(tmpMasks, aMask, [','], #0);
     814
     815  for i := 0 to tmpMasks.Count - 1 do
     816  begin
     817    tmpMask := tmpMasks[i];
     818    if not makeDefaultAssociation(tmpMask, hDesktopObject ) then
     819    begin
     820      tmpMasks.Destroy;
     821      exit;
     822    end;
     823  end;
     824
     825  tmpMasks.Destroy;
     826
    802827  Result := true;
    803828end;
     
    838863    WPERR_INVALID_FOLDER:
    839864      DoErrorDlg( 'Warning',
    840                   'Unable to create desktop icon:' + EndLine
     865                  'Unable to create desktop icon:' + StrCRLF
    841866                  + IntToHex( PMError, 8 )
    842867                  + ': The desktop is not correctly installed '
     
    845870    WPERR_NOT_WORKPLACE_CLASS:
    846871      DoErrorDlg( 'Warning',
    847                   'Unable to create desktop icon:' + EndLine
     872                  'Unable to create desktop icon:' + StrCRLF
    848873                  + IntToHex( PMError, 8 )
    849874                  + ': WPProgram class is missing.' );
     
    851876    else
    852877      DoErrorDlg( 'Installation Error',
    853                   'Unable to create desktop icon' + EndLine
     878                  'Unable to create desktop icon' + StrCRLF
    854879                  + IntToHex( PMError, 8 )
    855880                  + ': There may be some problem with the desktop.' );
     
    870895  Files: TStringList;
    871896  i: longint;
    872   RemainingNames: string;
    873897  FileName: string;
    874   VarName: string;
     898  tmpVarNames : TStringList;
    875899  FileDir: string;
    876900  CorrectDir: string;
     
    882906
    883907  FileName := ExtractFileName( CorrectPath );
    884   RemainingNames := VarNames;
    885   while RemainingNames <> '' do
    886   begin
    887     VarName := ExtractNextValue( RemainingNames, ';' );
    888     GetFilesForPath( VarName,
    889                      FileName,
    890                      Files );
    891   end;
     908
     909  tmpVarNames := TStringList.Create;
     910  StrExtractStrings(tmpVarNames, VarNames, [';'], #0);
     911  for i := 0 to tmpVarNames.Count - 1 do
     912  begin
     913    GetFilesInPath( tmpVarNames[i], FileName, Files );
     914  end;
     915  tmpVarNames.Destroy;
    892916
    893917  CorrectDir := ExtractFilePath( CorrectPath );
     
    903927
    904928    // if it's where we're aiming for then that's fine
    905     if    StringsSame( FileDir, CorrectDir )
    906        or StringsSame( FileDir, GetApplicationDir )
     929    if    StrEqualIgnoringCase( FileDir, CorrectDir )
     930       or StrEqualIgnoringCase( FileDir, GetApplicationDir )
    907931      then
    908932      Files.Delete( i )
     
    915939      DoConfirmListDlg( 'Duplicates Warning',
    916940                        'The file'
    917                         + EndLine
     941                        + StrCRLF
    918942                        + '  ' + FileName
    919                         + EndLine
     943                        + StrCRLF
    920944                        + 'will be installed to '
    921                         + EndLine
     945                        + StrCRLF
    922946                        + '  ' + ExtractFilePath( CorrectPath )
    923                         + EndLine
     947                        + StrCRLF
    924948                        + 'but there are other copies on your computer. '
    925949                        + 'The wrong file might be used. '
     
    10391063        DoErrorDlg( 'Folder Error',
    10401064                    'Could not create the NewView doc folder '
    1041                     + DocDir+ EndLine
     1065                    + DocDir+ StrCRLF
    10421066                    + SysErrorMessage( E.ErrorCode ) );
    10431067        exit;
     
    12901314
    12911315  // validate/create install dir
    1292   InstallDir := AddSlash( InstallFolderEdit.Text );
     1316  InstallDir := AddDirectorySeparator(InstallFolderEdit.Text);
    12931317  if InstallToSourceCheckbox.Checked then
    12941318  begin
     
    13041328        DoErrorDlg( 'Folder Error',
    13051329                    'Could not create the installation folder '
    1306                     + InstallDir + EndLine
     1330                    + InstallDir + StrCRLF
    13071331                    + SysErrorMessage( E.ErrorCode ) );
    13081332        exit;
  • trunk/installer/NewViewInstall.pas

    r144 r208  
    22
    33Uses
    4   Forms, MainFormUnit, ChooseFolderFormUnit;
     4  Forms,
     5  MainFormUnit,
     6  ChooseFolderFormUnit;
    57
    68{$r NewViewInstall.scu}
Note: See TracChangeset for help on using the changeset viewer.