Changeset 1639
- Timestamp:
- 2000-11-01T08:58:25+13:00 (23 years ago)
- Location:
- trunk/gsinstaller
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsinstaller/gsinstall.cpp
r1638 r1639 353 353 FilePath *logPath = new FilePath(this->destinationPath->pathString(), "install.log"); 354 354 this->setLogFile(logPath->pathString()); 355 delete logPath;} 355 this->readLog(); 356 delete logPath; 357 } 356 358 357 359 bool GSInstall::setUninstall() -
trunk/gsinstaller/unInstall.cpp
r1638 r1639 5 5 #include "File.h" 6 6 7 bool installManager:: ensureLog()7 bool installManager::logExists() 8 8 { 9 9 HANDLE fHandle; … … 13 13 FILE_ATTRIBUTE_NORMAL, NULL); 14 14 if (fHandle == INVALID_HANDLE_VALUE) 15 { 16 fHandle = CreateFile(this->logfileName.c_str(), GENERIC_READ | GENERIC_WRITE, 15 { return false; 16 } 17 CloseHandle(fHandle); 18 return true; 19 } 20 21 bool installManager::ensureLog() 22 { 23 if (this->logExists() == false) 24 { HANDLE fHandle; 25 26 fHandle = CreateFile(this->logfileName.c_str(), GENERIC_READ | GENERIC_WRITE, 17 27 FILE_SHARE_WRITE, NULL, CREATE_NEW, 18 28 FILE_ATTRIBUTE_NORMAL, NULL); … … 24 34 return false; 25 35 } 26 else27 { CloseHandle(fHandle);28 }29 36 return true; 30 37 } … … 40 47 stringArray params; 41 48 42 // open the log file 49 // don't try to open an non-existing log; this has serious 50 // repercussions with bad old VC++ 51 if (!this->logExists()) 52 { this->setModule("default"); 53 this->changed = false; 54 return true; 55 } 56 57 // open the log file 43 58 this->logfile.open(this->logfileName.c_str(), ios::in); 44 45 // Get the commands into this object from the existing log file 46 while ((command = this->readCommand(params)) != "") 47 { if (command[0] == '[' && command[command.length()-1] == ']') 48 { this->setModule(command.substr(1, command.length() - 2)); 59 if (this->logfile.is_open()) 60 { 61 // Get the commands into this object from the existing log file 62 while ((command = this->readCommand(params)) != "") 63 { if (command[0] == '[' && command[command.length()-1] == ']') 64 { this->setModule(command.substr(1, command.length() - 2)); 65 } 66 else 67 { unInstallCommand action(command, params); 68 this->storeCommand(action); 69 } 49 70 } 50 else 51 { unInstallCommand action(command, params); 52 this->storeCommand(action); 53 } 71 72 // close the logfile 73 this->logfile.close(); 74 75 // and clear the status bits, 'cos VC++ doesn't clear them when 76 // we reopen the file later. 77 this->logfile.clear(); 54 78 } 55 79 this->changed = false; 56 57 // close the logfile58 this->logfile.close();59 80 60 81 // set to the default module … … 216 237 this->ensureLog(); 217 238 this->logfile.open(this->logfileName.c_str(), ios::out); 218 239 if (!this->logfile.is_open()) 240 { MessageBox(0, "Unable to open log file", "Test", MB_OK); 241 } 242 219 243 unInstallCommandMap::iterator here = this->modules.begin(); 220 244 unInstallCommandMap::iterator end = this->modules.end(); -
trunk/gsinstaller/unInstall.h
r1638 r1639 65 65 public: 66 66 installManager() { this->changed = false; } 67 bool logExists(); 67 68 bool setLogFile(string filename); 68 69 bool ensureLog();
Note:
See TracChangeset
for help on using the changeset viewer.