Changeset 2063 for trunk/gsinstaller


Ignore:
Timestamp:
2001-02-24T04:47:04+13:00 (23 years ago)
Author:
cs025
Message:

Improvements towards fixing Windows 3.1 uninstallation.

Location:
trunk/gsinstaller
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsinstaller/gsManifest.cpp

    r2013 r2063  
    307307      if (!RemoveDirectory(params[0].c_str()))
    308308      {
    309         MessageBox(0, "Remove failed", params[0].c_str(), MB_OK);
    310309            this->removeFailed.add(params[0]);
    311310      }
  • trunk/gsinstaller/gsProgman.cpp

    r1878 r2063  
    221221    {
    222222      // flag error by returning false
     223    MessageBox(0, "Couldn't create group", "Greenstone Installer", MB_OK);
    223224      return false;
    224225    }
     
    324325      return false;
    325326    }
    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
    327333      // and now add the item itself to the active (given) group
    328334      sprintf(buffer, "[AddItem(%s,%s)]", iconDestination.c_str(), iconName.c_str());
     
    330336    {
    331337      // TODO: again work out what the problems could be
     338    MessageBox(0, "Can't create item", "Greenstone Installer", MB_OK);
    332339      return false;
    333340    }
  • trunk/gsinstaller/gsinstall.cpp

    r2013 r2063  
    6464  gsProgramManager *progman; // program manager connection
    6565
     66  string setupExe; // form to use for gs(s)setup.exe
     67
    6668  void getSourcePath();
    6769  void getExistingInstall();
     
    7375  FilePath *installPath();
    7476  FilePath *installSourcePath() { return this->sourcePath; }
     77  string setupExeLeaf() { return this->setupExe; }
    7578  bool copyFiles();
    7679  bool updateRegistry();
     
    108111GSInstall::GSInstall(bool uninstall)
    109112  : installManager()
    110 { 
     113{
    111114  // get the installation configuration file
    112115  this->configFile = new configureFile("install.cfg");
     
    119122  // don't attempt this with windows 3.1
    120123  if (!this->platform.isWindows32s())
    121     { 
     124    {
    122125      // get the registry
    123126      this->gsRegister  = new gsRegistry(*this, *this->configFile);
     127      this->setupExe    = "gssetup.exe";
    124128    }
    125129  else
    126     {   
     130    {
    127131      // TODO: in windows 3.1 we can't use the register as it isn't fully/properly
    128132      //       implemented; we must get the existing path information from elsewhere
    129133      this->gsRegister = new gsRegistry(*this, *this->configFile);
     134      this->setupExe   = "gsetup.exe";
    130135    }
    131136
     
    137142  // "source" directory - see later
    138143  if (uninstall == false)
    139     { 
     144    {
    140145      this->getExistingInstall();
    141146    }
     
    146151  // if doing an uninstall we now know where the "uninstall" is
    147152  if (uninstall == true)
    148     {   
     153    {
    149154      this->collectPath = this->sourcePath;
    150155    }
     
    152157  // get the manifest and program manager objects
    153158  if (uninstall)
    154     {   
     159    {
    155160      this->manifest = new gsManifest(*this);
    156161    }
    157162  else
    158     { 
     163    {
    159164      this->manifest = new gsManifest(*this, *this->sourcePath);
    160165    }
     
    278283      //      FilePath *serverPath = new FilePath(this->destinationPath->pathString(), "server.exe");
    279284      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);
    281286      FilePath *logPath = new FilePath(this->destinationPath->pathString(), "install.log");
    282287      string exeKeyPath, uninstallCmd, uninstallKeyPath;
     
    384389    {
    385390      // copy this and install.log to temporary directory and restart
    386       FilePath exePath(*this->sourcePath, "gssetup.exe");
     391      FilePath exePath(*this->sourcePath, this->setupExe);
    387392      FilePath logPath(*this->sourcePath, "install.log");
    388393
    389       FilePath exeDest(tempPath, "gssetup.exe");
     394      FilePath exeDest(tempPath, this->setupExe);
    390395      FilePath logDest(tempPath, "install.log");
    391396
     
    513518
    514519
    515     FilePath uninstallPath(this->destinationPath->pathString(), "gssetup.exe");
     520      FilePath uninstallPath(this->destinationPath->pathString(), this->setupExe);
    516521    FilePath logPath(this->destinationPath->pathString(), "install.log");
    517522    if (this->platform.isWindows32s() == false) // NB: don't add this shortcut under
    518523                                              // Windows32s as it causes a crash
    519                                               // 
     524                                              //
    520525                                              // TODO: reinstate this with Win3.1
    521526                                              // happy code
     
    527532    }
    528533    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      }
    530538    }
    531539      // disconnect from program manager
     
    632640      destExePath = this->collectPath;
    633641    }
    634   FilePath destExeFile(*destExePath, "gssetup.exe");
     642    FilePath destExeFile(*destExePath, this->setupExe);
    635643
    636644  if (this->platform.isWindows32s() == false) // NB: Don't copy the setup executable
     
    640648        return false;
    641649        }
     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());
    642661  }
    643662  return true;
     
    9851004          // get it's parent to find where the gssetup executable will be
    9861005          FilePath *logParent = logPath.parent();
    987           FilePath uninstallPath(*logParent, "gssetup.exe");
     1006          FilePath uninstallPath(*logParent, install.setupExeLeaf());
    9881007
    9891008          // delete the gssetup executable
    9901009          DeleteFile(uninstallPath.cString());
    9911010
    992         MessageBox(0, logParent->cString(), "Removing", MB_OK);
     1011            // kill the original log parent directory if it should have died
    9931012          if (install.removeFailed(logParent->pathString()))
    9941013            {
     
    11001119           LPSTR CmdLine,
    11011120           int CmdShow)
    1102 { 
     1121{
    11031122  MSG msg;
    11041123
    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    }
    11071160
    11081161  app_instance = Current;
Note: See TracChangeset for help on using the changeset viewer.