Changeset 1545


Ignore:
Timestamp:
2000-09-14T02:01:44+12:00 (24 years ago)
Author:
cs025
Message:

Improved logging of manifest items, tidied the handling of items with extended
paths in the manifest (logging creation of directories on the path); finally
removed some old garbage from gsinstall.cpp.

Location:
trunk/gsinstaller
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsinstaller/fileCopier.cpp

    r1541 r1545  
    4848}
    4949
     50bool fileCopySet::ensureParent(FilePath &child, fileCopyMonitor *monitor)
     51{ FilePath *parentName = child.parent();
     52
     53    // check for existence of parent
     54    if (parentName->exists() == false)
     55  { // ensure the grandparent exists
     56    if (!this->ensureParent(*parentName, monitor))
     57    { return false;
     58    }
     59
     60    // create parent directory
     61    _mkdir(parentName->cString());
     62
     63    // log the creation - we don't give a source - it's not needed for directories
     64    if (monitor != NULL)
     65    {   monitor->copiedDir(parentName->cString());
     66    }
     67  }
     68    delete parentName;
     69  return true;
     70}
     71
    5072/**
    5173 * Copy a particular file to its destination
     
    6284  destination = this->destination(file);
    6385
     86  // ensure that the parent exists, as some install requirements are for files with
     87  // directory paths which may not preexist
    6488    FilePath destPath(destination);
    65   FilePath *destDir = destPath.parent();
    66   if (!destDir->ensureWriteablePath())
    67   { delete destDir;
    68     return false;
    69   }
    70   delete destDir;
     89  this->ensureParent(destPath, monitor);
    7190
    7291  // get read and write file handles
     
    112131  if (monitor != NULL)
    113132    {
    114       monitor->copied(file->cString(), destination, false);
     133      monitor->copiedFile(file->cString(), destination);
    115134    }
    116135  delete destination;
     
    133152  if (file->isDirectory())
    134153    {
    135       // create directory
     154      // get destination directory
    136155      char *thisDestDir = this->destination(file);
    137       _mkdir(thisDestDir);
    138 
    139       // note amount of data copied
    140       // this->copied += file->getRawFileSize();
    141 
    142       // note for uninstall the action done
    143       if (monitor != NULL)
    144     {
    145       monitor->copied(file->cString(), thisDestDir, true);
    146     }
     156      FilePath destPath(thisDestDir);
     157
     158      // create a directory if needsbe
     159      if (destPath.exists() == false)
     160      {
     161        _mkdir(thisDestDir);
     162
     163          // note amount of data copied
     164        // this->copied += file->getRawFileSize();
     165
     166          // note for uninstall the action done
     167        if (monitor != NULL)
     168            {
     169                monitor->copiedDir(thisDestDir);
     170            }
     171      }
    147172
    148173      // copy children
  • trunk/gsinstaller/fileCopier.h

    r1536 r1545  
    99public:
    1010  fileCopyMonitor() {};
    11   virtual void copied(string from, string to, bool isDir) = 0;
     11  virtual void copiedFile(string from, string to) = 0;
     12  virtual void copiedDir(string dirName) = 0;
    1213};
    1314
     
    2526  unsigned long getOriginalSize();
    2627  unsigned long getCopiedSize(DiskSpace &space);
     28  bool ensureParent(FilePath &child, fileCopyMonitor *monitor);
    2729  bool copyFile(File *file, fileCopyMonitor *monitor, copyProgressBar &progressBar);
    2830  void copy(File *file, fileCopyMonitor *monitor, copyProgressBar &progressBar);
  • trunk/gsinstaller/gsManifest.cpp

    r1543 r1545  
    278278}
    279279
    280 void gsManifest::copied(string from, string to, bool isDir)
    281 {
    282   if (isDir)
    283     {
    284       this->logAction("Manifest.CreateDir", to);
    285     }
    286   else
    287     {   
    288       this->logAction("Manifest.CopyFile", from, to);
    289     }
     280void gsManifest::copiedFile(string from, string to)
     281{ this->logAction("Manifest.CopyFile", from, to);
     282}
     283
     284void gsManifest::copiedDir(string dirName)
     285{ this->logAction("Manifest.CreateDir", dirName);
    290286}
    291287
  • trunk/gsinstaller/gsManifest.h

    r1543 r1545  
    4848  bool selectCheckSpace();
    4949 
    50   void copied(string from, string to, bool isDir); // from fileCopyMonitor
     50  void copiedFile(string from, string to); // from fileCopyMonitor
     51  void copiedDir(string dirName); // from fileCopyMonitor
    5152};
    5253#endif;
  • trunk/gsinstaller/gsinstall.cpp

    r1543 r1545  
    371371  // if we are not running in the Windows temporary directory, copy this exe
    372372  // and the installation log to the temporary directory and run them there
     373  MessageBox(0, tempPath.cString(), this->sourcePath->cString(), MB_OK);
    373374  if (*this->sourcePath != tempPath)
    374375    {
     
    921922    case WM_USER:
    922923      {
     924    if (strstr(app_cmdLine, "-u") != NULL)
     925      {
    923926    // uninstall action
    924     if (strstr(app_cmdLine, "-u") != NULL)
    925       {
     927
    926928        // skip past the -u option itself
    927929        char *at = strstr(app_cmdLine, "-u");
    928930        at += strlen("-u");
    929        
     931
    930932        // extract the log file path from the command line
    931933        while (*at == ' ')
    932           { 
     934          {
    933935        at ++;
    934936          }
     
    941943          {
    942944          install.uninstall();
    943          
     945
    944946          // close the log to write back all changes to the log; if the file
    945947          // will be deleted, it must be closed; copying may also fail, so it's
    946948          // safer to close it before doing either.
    947949          install.closeLog();
    948          
     950
    949951          // if the install is empty, terminate all final items (currently the
    950952          // log and setup executables,
     
    953955          // delete the log file
    954956          DeleteFile(logPath.cString());
    955          
     957
    956958          // get it's parent to find where the gssetup executable will be
    957959          FilePath *logParent = logPath.parent();
     
    973975    // install wizard
    974976    else
    975       { 
     977      {
    976978        GSInstall install(false);
    977979        GSInstall_init_wizard(install);
     
    10071009      break;
    10081010     
     1011    case WM_USER + 1:
     1012    break;
     1013
    10091014    case WM_CLOSE:
    10101015      /*if (!file_ischanged || IDCANCEL != file_query(Window, file_name))*/
     
    10381043                app_instance,
    10391044                NULL);
    1040  
     1045
    10411046  ShowWindow(app_window, Show);
    1042  
     1047
    10431048  PostMessage(app_window, WM_USER, 0, 0L);
    10441049}
    10451050
    10461051void WinClassInit(void)
    1047 { 
     1052{
    10481053  WNDCLASS Class;
    10491054
     
    10551060  Class.lpszMenuName = NULL;
    10561061  Class.hbrBackground = (HBRUSH) (COLOR_APPWORKSPACE+1);
    1057   //Class.style = NULL;
    10581062  Class.style = 0;
    10591063  Class.cbClsExtra = 0;
    10601064  Class.cbWndExtra = 0;
    10611065  RegisterClass(&Class);
    1062   /*
    1063     Class.lpszClassName = "GSInstall:Splash";
    1064     Class.hInstance = app_instance;
    1065     Class.lpfnWndProc = (WNDPROC) splash_windproc;
    1066     Class.hCursor = LoadCursor(NULL, IDC_ARROW);
    1067     Class.hIcon = NULL;
    1068     Class.lpszMenuName = NULL;
    1069     Class.hbrBackground = (HBRUSH) (COLOR_WINDOW+1);
    1070     Class.style = NULL;
    1071     Class.cbClsExtra = 0;
    1072     Class.cbWndExtra = 0;
    1073     RegisterClass(&Class);*/
    10741066}
    10751067
     
    10801072{
    10811073  MSG msg;
    1082   // HACCEL accel;
    10831074
    10841075  app_cmdLine = (char *) malloc(lstrlen(CmdLine) + 1);
     
    10911082      WinClassInit();
    10921083      InitCommonControls();
    1093       //    grbStatic_registerClass(Current);
    1094     }
    1095  
     1084    }
     1085
    10961086  /* -- init instance */
    10971087  GSInstall_init(Current, CmdShow);
    1098  
    1099   //  config_init("ReTreeval");
    1100 
    1101   //  accel = LoadAccelerators(Current, "ReTreevalMenu");
    11021088
    11031089  while (GetMessage(&msg, NULL, 0, 0))
    11041090    {
    1105       /*if (!TranslateAccelerator(app_window, accel, &msg))
    1106     { */
    11071091      TranslateMessage(&msg);
    11081092      DispatchMessage(&msg);
    1109       /*}*/
    11101093    }
    11111094  return (int) msg.wParam;
Note: See TracChangeset for help on using the changeset viewer.