version 1.48, 2006/07/26 09:26:18
|
version 1.49, 2006/09/12 17:26:20
|
|
|
// | // |
// Create a rollback file which is a copy of the index file. The | // Create a rollback file which is a copy of the index file. The |
// new filename is formed by appending ".rollback" to the name of | // new filename is formed by appending ".rollback" to the name of |
// the index file. |
// the index file. The rollback file, if it exists, is considered |
|
// the "master" copy of the data. To ensure its completeness, the |
|
// index file is renamed to the rollback file and the data is then |
|
// copied back to the index file. |
// | // |
if (!FileSystem::copyFile(path, rollbackPath)) |
|
|
if (!FileSystem::renameFileNoCase(path, rollbackPath)) |
|
{ |
|
PEG_METHOD_EXIT(); |
|
return false; |
|
} |
|
|
|
if (!FileSystem::copyFile(rollbackPath, path)) |
{ | { |
// Make sure no rollback file is left over. |
// Try to restore the initial state |
FileSystem::removeFileNoCase(rollbackPath); |
FileSystem::removeFileNoCase(path); |
|
FileSystem::renameFileNoCase(rollbackPath, path); |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
return false; | return false; |