- Timestamp:
- Mar 12, 2019, 4:49:32 PM (6 years ago)
- Location:
- trunk/installer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/installer/MainFormUnit.pas
r409 r425 23 23 Description = 'NewView Install'; 24 24 25 Version = 'V1.10. 0'; // $SS_REQUIRE_NEW_VERSION$26 BldLevelVersion = '1.10. 0'; // Embedded for IBM BLDLEVEL tool25 Version = 'V1.10.1'; // $SS_REQUIRE_NEW_VERSION$ 26 BldLevelVersion = '1.10.1'; // Embedded for IBM BLDLEVEL tool 27 27 28 28 // BLDLevel - compatible - mostly … … 414 414 FSystemDLLDir := FSystemDir + 'dll\'; 415 415 416 // ecs things416 // aos/ecs things 417 417 FEnv_OSDir := GetEnvironmentFolder( 'OSDIR' ); 418 418 FEnv_Programs := GetEnvironmentFolder( 'PROGRAMS' ); … … 570 570 begin 571 571 DoErrorDlg( 'Install Error', 572 'Unable to acces ' + StrCRLF572 'Unable to access ' + StrCRLF 573 573 + ' ' + DestinationPath + StrCRLF 574 574 + SysErrorMessage( rc ) ); … … 976 976 end; 977 977 978 function MoveFileError( const Source: string; 979 const Dest: string; 980 const IsModule: boolean; 981 var SourceInUse: boolean ): boolean; 982 var 983 rc: APIRET; 984 szSource: cstring; 985 FileHandle: HFILE; 986 ActionTaken: ULONG; 987 begin 988 // First copy the file 989 Result := CopyFileError( Source, 990 Dest ); 991 if not Result then exit; 992 993 // Now delete the original 994 szSource := Source; 995 // see if it's in use. 996 rc := DosOpen( szSource, 997 FileHandle, 998 ActionTaken, 999 0, // new size: not used 1000 0, // attributes: not used 1001 OPEN_ACTION_FAIL_IF_NEW + OPEN_ACTION_OPEN_IF_EXISTS, 1002 OPEN_FLAGS_FAIL_ON_ERROR + OPEN_SHARE_DENYREADWRITE 1003 + OPEN_ACCESS_READWRITE, 1004 nil ); // e.a.s: not used 1005 DosClose( FileHandle ); 1006 if rc = ERROR_SHARING_VIOLATION then 1007 begin 1008 // file in use 1009 if not IsModule then 1010 begin 1011 Result := false; 1012 DoErrorDlg( 'Installation Error', 1013 'This file is in use: ' + StrCRLF 1014 + ' ' + Source + StrCRLF 1015 + 'and cannot be moved.' ); 1016 exit; 1017 end; 1018 1019 // unlock the module 1020 SourceInUse := true; 1021 rc := DosReplaceModule( Addr( szSource ), 1022 nil, 1023 nil ); 1024 if rc <> 0 then 1025 begin 1026 // error 1027 Result := false; 1028 DoErrorDlg( 'Install Error', 1029 'Could not unlock ' + StrCRLF 1030 + ' ' + Source + StrCRLF 1031 + SysErrorMessage( rc ) ); 1032 1033 exit; 1034 end; 1035 end; 1036 Result := DeleteFile( Source ); 1037 end; 1038 978 1039 // Do a full install, replacing parts of the operating system 979 1040 // as needed. … … 990 1051 ObjectID: string; 991 1052 rc: longint; 1053 HelpMgrDllPath: string; 1054 HelpMgrOriginal: string; 992 1055 HelpMgrBackupPath: string; 993 1056 StubBackupPath: string; … … 1071 1134 1072 1135 // install viewer app to either x:\os2 1073 // or on eCS, %OSDIR%\bin1136 // or on ArcaOS or eCS, %OSDIR%\bin 1074 1137 if FEnv_OSDir <> '' then 1075 1138 begin 1076 // ecs - with a dir specified1139 // aos/ecs - with a dir specified 1077 1140 AppDir := FEnv_OSDir + 'bin\'; 1078 1141 end … … 1083 1146 end; 1084 1147 1085 LanguageDir := AppDir; // for now. 1148 if FEnv_OSDir <> '' then 1149 begin 1150 LanguageDir := FEnv_OSDir + 'lang\'; 1151 end 1152 else 1153 begin 1154 LanguageDir := AppDir; // for now. 1155 end; 1086 1156 1087 1157 // Where shall we put the programs eh? 1088 1158 FAppInstallPath := AppDir + 'NewView.exe'; 1089 1159 FStubInstallPath := FSystemDir + 'view.exe'; 1090 FDllInstallPath := FSystemDLLDir + 'newview.dll'; 1160 1161 if FEnv_OSDir <> '' then 1162 begin 1163 FDllInstallPath := FEnv_OSDir + 'dll\'; 1164 end 1165 else 1166 begin 1167 FDllInstallPath := FSystemDLLDir; 1168 end; 1091 1169 1092 1170 // check for existing files that might conflict … … 1188 1266 if GetInstallType = itComplete then 1189 1267 begin 1268 HelpMgrDllPath := FDllInstallPath + 'HelpMgr.dll'; 1269 HelpMgrOriginal := FSystemDLLDir + 'HelpMgr.dll'; 1190 1270 HelpMgrBackupPath := FSystemDLLDir + 'HelpMgr.bak'; 1271 1272 // Back up the original HELPMGR.DLL. We have to do this separately 1273 // (rather than in Installfile) because it might not be in the same 1274 // place as our replacement. 1275 if FileExists( HelpMgrOriginal ) and 1276 not FileExists( HelpMgrBackupPath ) then 1277 begin 1278 if not MoveFileError( HelpMgrOriginal, 1279 HelpMgrBackupPath, 1280 true, FDLLInUse ) then 1281 exit; 1282 end; 1283 1284 // Now install the new HelpMgr 1191 1285 if not InstallFile( 'HelpMgr.dll', 1192 FSystemDLLDir + 'HelpMgr.dll',1193 HelpMgrBackupPath,1286 HelpMgrDllPath, 1287 '', 1194 1288 true, 1195 1289 FDLLInUse ) then … … 1226 1320 // newview.dll 1227 1321 if not InstallFile( 'NewView.dll', 1228 FDllInstallPath ,1322 FDllInstallPath + 'newview.dll', 1229 1323 '', // no backup 1230 1324 false, // not in use
Note:
See TracChangeset
for help on using the changeset viewer.