Changeset 2288 for trunk/gsinstaller


Ignore:
Timestamp:
2001-04-06T03:17:03+12:00 (23 years ago)
Author:
cs025
Message:

Improvements to destroy the gsdlsite.cfg file as required at uninstall.

Location:
trunk/gsinstaller
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsinstaller/gsProfile.cpp

    r1541 r2288  
    11#include "gsProfile.h"
     2#include "FilePath.h"
    23
    34#include <stdio.h>
     
    56gsProfile::gsProfile(installManager &manager, string fileName)
    67  : installAgent(manager)
    7 {   this->fileName  = fileName;
     8{ FilePath path(fileName);
     9
     10    this->fileName  = fileName;
     11    if (path.exists() == false)
     12  { this->logAction("ProfileCreate", "", "", "");
     13  }
    814}
    915
     
    1925
    2026bool gsProfile::undoAction(string actionName, stringArray &params)
    21 {   if (actionName == "ProfileAddListMember")
    22     {   this->removeListMember(params[0], params[1], params[2]);
     27{ if (actionName == "ProfileCreate")
     28  { if (this->fileName == params[0])
     29    {   DeleteFile(params[0].c_str());
     30    }
     31  }
     32  else if (actionName == "ProfileAddListMember")
     33  { this->removeListMember(params[0], params[1], params[2]);
     34    return true;
     35  }
     36  else if (actionName == "ProfileSetItem")
     37  { this->removeString(params[1], params[2]);
    2338    return true;
    2439  }
     
    90105    return false;
    91106  }
     107  this->logAction("ProfileSetItem", sectionName, itemName, itemValue);
    92108  return true;
    93109}
     110
     111bool gsProfile::removeString(string sectionName, string itemName)
     112{ if (!WritePrivateProfileString( sectionName.c_str(), itemName.c_str(),
     113                                    NULL, this->fileName.c_str()))
     114    { MessageBox(0, "Failed", itemName.c_str(), MB_OK);
     115    return false;
     116  }
     117  return true;
     118}
  • trunk/gsinstaller/gsProfile.h

    r1539 r2288  
    3030  bool addListMember(string sectionName, string listName, string listMember);
    3131  bool writeString(string sectionName, string itemName, string itemValue);
     32  bool removeString(string sectionName, string itemName);
    3233  bool undoAction(string actionName, stringArray &params);
    3334};
  • trunk/gsinstaller/gsinstall.cpp

    r2073 r2288  
    425425  this->manifest = new gsManifest(*this); // get a manifest manager
    426426
    427   iniPath = new FilePath(this->collectPath->pathString(), "gsdlsite.cfg");
     427  iniPath = new FilePath(this->installRoot(), "gsdlsite.cfg");
    428428  gsProfile gsdlProfile(*this, iniPath->pathString());
    429429
  • trunk/gsinstaller/unInstall.cpp

    r2013 r2288  
    2424    {   HANDLE fHandle;
    2525
     26    unInstallCommand command("InstallRoot");
     27    command.addParameter(this->logfileName);
     28
     29    if (this->modules["default"].begin()->command != "InstallRoot")
     30    {   this->modules["default"].insert(this->modules["default"].begin(), command);
     31    }
    2632        fHandle = CreateFile(this->logfileName.c_str(), GENERIC_READ | GENERIC_WRITE,
    2733                         FILE_SHARE_WRITE, NULL, CREATE_NEW,
     
    3339        }
    3440        return false;
     41    }
     42    else
     43    {   if (this->modules["default"].begin()->command == "InstallRoot")
     44        {   this->logfileName = this->modules["default"].begin()->parameters[0];
     45      }
    3546    }
    3647    return true;
     
    288299}
    289300
     301string installManager::installRoot()
     302{   if (this->modules["default"].begin()->command != "InstallRoot")
     303        return "";
     304    return this->modules["default"].begin()->parameters[0];
     305}
     306
    290307installManager::~installManager()
    291308{   this->recordLog();
  • trunk/gsinstaller/unInstall.h

    r1673 r2288  
    8080  string popCommand(stringArray &params);
    8181  bool isEmpty();
     82  string installRoot();
    8283  ~installManager();
    8384};
Note: See TracChangeset for help on using the changeset viewer.