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.

File:
1 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
Note: See TracChangeset for help on using the changeset viewer.