Changeset 2063
- Timestamp:
- 2001-02-24T04:47:04+13:00 (23 years ago)
- Location:
- trunk/gsinstaller
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsinstaller/gsManifest.cpp
r2013 r2063 307 307 if (!RemoveDirectory(params[0].c_str())) 308 308 { 309 MessageBox(0, "Remove failed", params[0].c_str(), MB_OK);310 309 this->removeFailed.add(params[0]); 311 310 } -
trunk/gsinstaller/gsProgman.cpp
r1878 r2063 221 221 { 222 222 // flag error by returning false 223 MessageBox(0, "Couldn't create group", "Greenstone Installer", MB_OK); 223 224 return false; 224 225 } … … 324 325 return false; 325 326 } 326 327 328 // if the item is there already, mark it for replacement; this may fail, 329 // so we don't test for success 330 sprintf(buffer, "[ReplaceItem(%s)]", iconName.c_str()); 331 DDEShellCommand(this->instance, buffer); 332 327 333 // and now add the item itself to the active (given) group 328 334 sprintf(buffer, "[AddItem(%s,%s)]", iconDestination.c_str(), iconName.c_str()); … … 330 336 { 331 337 // TODO: again work out what the problems could be 338 MessageBox(0, "Can't create item", "Greenstone Installer", MB_OK); 332 339 return false; 333 340 } -
trunk/gsinstaller/gsinstall.cpp
r2013 r2063 64 64 gsProgramManager *progman; // program manager connection 65 65 66 string setupExe; // form to use for gs(s)setup.exe 67 66 68 void getSourcePath(); 67 69 void getExistingInstall(); … … 73 75 FilePath *installPath(); 74 76 FilePath *installSourcePath() { return this->sourcePath; } 77 string setupExeLeaf() { return this->setupExe; } 75 78 bool copyFiles(); 76 79 bool updateRegistry(); … … 108 111 GSInstall::GSInstall(bool uninstall) 109 112 : installManager() 110 { 113 { 111 114 // get the installation configuration file 112 115 this->configFile = new configureFile("install.cfg"); … … 119 122 // don't attempt this with windows 3.1 120 123 if (!this->platform.isWindows32s()) 121 { 124 { 122 125 // get the registry 123 126 this->gsRegister = new gsRegistry(*this, *this->configFile); 127 this->setupExe = "gssetup.exe"; 124 128 } 125 129 else 126 { 130 { 127 131 // TODO: in windows 3.1 we can't use the register as it isn't fully/properly 128 132 // implemented; we must get the existing path information from elsewhere 129 133 this->gsRegister = new gsRegistry(*this, *this->configFile); 134 this->setupExe = "gsetup.exe"; 130 135 } 131 136 … … 137 142 // "source" directory - see later 138 143 if (uninstall == false) 139 { 144 { 140 145 this->getExistingInstall(); 141 146 } … … 146 151 // if doing an uninstall we now know where the "uninstall" is 147 152 if (uninstall == true) 148 { 153 { 149 154 this->collectPath = this->sourcePath; 150 155 } … … 152 157 // get the manifest and program manager objects 153 158 if (uninstall) 154 { 159 { 155 160 this->manifest = new gsManifest(*this); 156 161 } 157 162 else 158 { 163 { 159 164 this->manifest = new gsManifest(*this, *this->sourcePath); 160 165 } … … 278 283 // FilePath *serverPath = new FilePath(this->destinationPath->pathString(), "server.exe"); 279 284 FilePath *serverPath = new FilePath(this->destinationPath->pathString(), "server.exe"); 280 FilePath *setupPath = new FilePath(this->destinationPath->pathString(), "gssetup.exe");285 FilePath *setupPath = new FilePath(this->destinationPath->pathString(), this->setupExe); 281 286 FilePath *logPath = new FilePath(this->destinationPath->pathString(), "install.log"); 282 287 string exeKeyPath, uninstallCmd, uninstallKeyPath; … … 384 389 { 385 390 // copy this and install.log to temporary directory and restart 386 FilePath exePath(*this->sourcePath, "gssetup.exe");391 FilePath exePath(*this->sourcePath, this->setupExe); 387 392 FilePath logPath(*this->sourcePath, "install.log"); 388 393 389 FilePath exeDest(tempPath, "gssetup.exe");394 FilePath exeDest(tempPath, this->setupExe); 390 395 FilePath logDest(tempPath, "install.log"); 391 396 … … 513 518 514 519 515 FilePath uninstallPath(this->destinationPath->pathString(), "gssetup.exe");520 FilePath uninstallPath(this->destinationPath->pathString(), this->setupExe); 516 521 FilePath logPath(this->destinationPath->pathString(), "install.log"); 517 522 if (this->platform.isWindows32s() == false) // NB: don't add this shortcut under 518 523 // Windows32s as it causes a crash 519 // 524 // 520 525 // TODO: reinstate this with Win3.1 521 526 // happy code … … 527 532 } 528 533 else 529 { MessageBox(0, uninstallPath.cString(), logPath.cString(), MB_OK); 534 { if (!this->progman->addIcon(groupName, "Uninstall", uninstallPath.pathString() + " -u " + logPath.pathString(), "", 535 "Remove this Greenstone collection")) 536 { 537 } 530 538 } 531 539 // disconnect from program manager … … 632 640 destExePath = this->collectPath; 633 641 } 634 FilePath destExeFile(*destExePath, "gssetup.exe");642 FilePath destExeFile(*destExePath, this->setupExe); 635 643 636 644 if (this->platform.isWindows32s() == false) // NB: Don't copy the setup executable … … 640 648 return false; 641 649 } 650 } 651 else 652 { // Windows 3.1 has a peculiar behaviour on calling CopyFile on an .exe; 653 // it doesn't. (Copy the file); thus we copy to an non-exe file and then 654 // rename it into an exe file; this works. 655 FilePath intExeFile(*destExePath, "gsetup.ex"); 656 if (!CopyFile(srcExeFile.cString(), intExeFile.cString(), false)) 657 { 658 return false; 659 } 660 MoveFile(intExeFile.cString(), destExeFile.cString()); 642 661 } 643 662 return true; … … 985 1004 // get it's parent to find where the gssetup executable will be 986 1005 FilePath *logParent = logPath.parent(); 987 FilePath uninstallPath(*logParent, "gssetup.exe");1006 FilePath uninstallPath(*logParent, install.setupExeLeaf()); 988 1007 989 1008 // delete the gssetup executable 990 1009 DeleteFile(uninstallPath.cString()); 991 1010 992 MessageBox(0, logParent->cString(), "Removing", MB_OK); 1011 // kill the original log parent directory if it should have died 993 1012 if (install.removeFailed(logParent->pathString())) 994 1013 { … … 1100 1119 LPSTR CmdLine, 1101 1120 int CmdShow) 1102 { 1121 { 1103 1122 MSG msg; 1104 1123 1105 app_cmdLine = (char *) malloc(lstrlen(CmdLine) + 1); 1106 lstrcpy(app_cmdLine, CmdLine); 1124 gsPlatform p; 1125 1126 if (p.isWindows32s()) 1127 { 1128 char filename[512]; 1129 FilePath *exePath; 1130 FilePath *dirPath; 1131 1132 // get the filepath of this executable 1133 GetModuleFileName(0, filename, 512); 1134 exePath = new FilePath(filename); 1135 1136 // get the parent (i.e. the folder containing this executable) for the source 1137 // folder 1138 dirPath = exePath->parent(); 1139 delete exePath; 1140 1141 exePath = new FilePath(dirPath->cString(), "install.log"); 1142 1143 if (exePath->exists()) 1144 { app_cmdLine = (char *) malloc(256); 1145 lstrcpy(app_cmdLine, "gsetup.exe -u "); 1146 lstrcat(app_cmdLine, exePath->cString()); 1147 } 1148 else 1149 { app_cmdLine = (char *) malloc(1); 1150 app_cmdLine[0] = '\0'; 1151 } 1152 1153 delete exePath; 1154 delete dirPath; 1155 } 1156 else 1157 { app_cmdLine = (char *) malloc(lstrlen(CmdLine) + 1); 1158 lstrcpy(app_cmdLine, CmdLine); 1159 } 1107 1160 1108 1161 app_instance = Current;
Note:
See TracChangeset
for help on using the changeset viewer.