Changeset 1545 for trunk/gsinstaller/fileCopier.cpp
- Timestamp:
- 2000-09-14T02:01:44+12:00 (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsinstaller/fileCopier.cpp
r1541 r1545 48 48 } 49 49 50 bool 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 50 72 /** 51 73 * Copy a particular file to its destination … … 62 84 destination = this->destination(file); 63 85 86 // ensure that the parent exists, as some install requirements are for files with 87 // directory paths which may not preexist 64 88 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); 71 90 72 91 // get read and write file handles … … 112 131 if (monitor != NULL) 113 132 { 114 monitor->copied (file->cString(), destination, false);133 monitor->copiedFile(file->cString(), destination); 115 134 } 116 135 delete destination; … … 133 152 if (file->isDirectory()) 134 153 { 135 // createdirectory154 // get destination directory 136 155 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 } 147 172 148 173 // copy children
Note:
See TracChangeset
for help on using the changeset viewer.