Changeset 1545 for trunk/gsinstaller
- Timestamp:
- 2000-09-14T02:01:44+12:00 (24 years ago)
- Location:
- trunk/gsinstaller
- Files:
-
- 5 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 -
trunk/gsinstaller/fileCopier.h
r1536 r1545 9 9 public: 10 10 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; 12 13 }; 13 14 … … 25 26 unsigned long getOriginalSize(); 26 27 unsigned long getCopiedSize(DiskSpace &space); 28 bool ensureParent(FilePath &child, fileCopyMonitor *monitor); 27 29 bool copyFile(File *file, fileCopyMonitor *monitor, copyProgressBar &progressBar); 28 30 void copy(File *file, fileCopyMonitor *monitor, copyProgressBar &progressBar); -
trunk/gsinstaller/gsManifest.cpp
r1543 r1545 278 278 } 279 279 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 } 280 void gsManifest::copiedFile(string from, string to) 281 { this->logAction("Manifest.CopyFile", from, to); 282 } 283 284 void gsManifest::copiedDir(string dirName) 285 { this->logAction("Manifest.CreateDir", dirName); 290 286 } 291 287 -
trunk/gsinstaller/gsManifest.h
r1543 r1545 48 48 bool selectCheckSpace(); 49 49 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 51 52 }; 52 53 #endif; -
trunk/gsinstaller/gsinstall.cpp
r1543 r1545 371 371 // if we are not running in the Windows temporary directory, copy this exe 372 372 // and the installation log to the temporary directory and run them there 373 MessageBox(0, tempPath.cString(), this->sourcePath->cString(), MB_OK); 373 374 if (*this->sourcePath != tempPath) 374 375 { … … 921 922 case WM_USER: 922 923 { 924 if (strstr(app_cmdLine, "-u") != NULL) 925 { 923 926 // uninstall action 924 if (strstr(app_cmdLine, "-u") != NULL) 925 { 927 926 928 // skip past the -u option itself 927 929 char *at = strstr(app_cmdLine, "-u"); 928 930 at += strlen("-u"); 929 931 930 932 // extract the log file path from the command line 931 933 while (*at == ' ') 932 { 934 { 933 935 at ++; 934 936 } … … 941 943 { 942 944 install.uninstall(); 943 945 944 946 // close the log to write back all changes to the log; if the file 945 947 // will be deleted, it must be closed; copying may also fail, so it's 946 948 // safer to close it before doing either. 947 949 install.closeLog(); 948 950 949 951 // if the install is empty, terminate all final items (currently the 950 952 // log and setup executables, … … 953 955 // delete the log file 954 956 DeleteFile(logPath.cString()); 955 957 956 958 // get it's parent to find where the gssetup executable will be 957 959 FilePath *logParent = logPath.parent(); … … 973 975 // install wizard 974 976 else 975 { 977 { 976 978 GSInstall install(false); 977 979 GSInstall_init_wizard(install); … … 1007 1009 break; 1008 1010 1011 case WM_USER + 1: 1012 break; 1013 1009 1014 case WM_CLOSE: 1010 1015 /*if (!file_ischanged || IDCANCEL != file_query(Window, file_name))*/ … … 1038 1043 app_instance, 1039 1044 NULL); 1040 1045 1041 1046 ShowWindow(app_window, Show); 1042 1047 1043 1048 PostMessage(app_window, WM_USER, 0, 0L); 1044 1049 } 1045 1050 1046 1051 void WinClassInit(void) 1047 { 1052 { 1048 1053 WNDCLASS Class; 1049 1054 … … 1055 1060 Class.lpszMenuName = NULL; 1056 1061 Class.hbrBackground = (HBRUSH) (COLOR_APPWORKSPACE+1); 1057 //Class.style = NULL;1058 1062 Class.style = 0; 1059 1063 Class.cbClsExtra = 0; 1060 1064 Class.cbWndExtra = 0; 1061 1065 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);*/1074 1066 } 1075 1067 … … 1080 1072 { 1081 1073 MSG msg; 1082 // HACCEL accel;1083 1074 1084 1075 app_cmdLine = (char *) malloc(lstrlen(CmdLine) + 1); … … 1091 1082 WinClassInit(); 1092 1083 InitCommonControls(); 1093 // grbStatic_registerClass(Current); 1094 } 1095 1084 } 1085 1096 1086 /* -- init instance */ 1097 1087 GSInstall_init(Current, CmdShow); 1098 1099 // config_init("ReTreeval");1100 1101 // accel = LoadAccelerators(Current, "ReTreevalMenu");1102 1088 1103 1089 while (GetMessage(&msg, NULL, 0, 0)) 1104 1090 { 1105 /*if (!TranslateAccelerator(app_window, accel, &msg))1106 { */1107 1091 TranslateMessage(&msg); 1108 1092 DispatchMessage(&msg); 1109 /*}*/1110 1093 } 1111 1094 return (int) msg.wParam;
Note:
See TracChangeset
for help on using the changeset viewer.