1192 |
} |
} |
1193 |
} |
} |
1194 |
|
|
1195 |
|
void List::LoadSubChunksRecursively() { |
1196 |
|
for (List* pList = GetFirstSubList(); pList; pList = GetNextSubList()) |
1197 |
|
pList->LoadSubChunksRecursively(); |
1198 |
|
} |
1199 |
|
|
1200 |
/** @brief Write list chunk persistently e.g. to disk. |
/** @brief Write list chunk persistently e.g. to disk. |
1201 |
* |
* |
1202 |
* Stores the list chunk persistently to its actual "physical" file. All |
* Stores the list chunk persistently to its actual "physical" file. All |
1388 |
* chunk or any kind of IO error occured |
* chunk or any kind of IO error occured |
1389 |
*/ |
*/ |
1390 |
void File::Save() { |
void File::Save() { |
1391 |
|
// make sure the RIFF tree is built (from the original file) |
1392 |
|
LoadSubChunksRecursively(); |
1393 |
|
|
1394 |
// reopen file in write mode |
// reopen file in write mode |
1395 |
SetMode(stream_mode_read_write); |
SetMode(stream_mode_read_write); |
1396 |
|
|
1468 |
void File::Save(const String& path) { |
void File::Save(const String& path) { |
1469 |
//TODO: we should make a check here if somebody tries to write to the same file and automatically call the other Save() method in that case |
//TODO: we should make a check here if somebody tries to write to the same file and automatically call the other Save() method in that case |
1470 |
|
|
1471 |
|
// make sure the RIFF tree is built (from the original file) |
1472 |
|
LoadSubChunksRecursively(); |
1473 |
|
|
1474 |
if (Filename.length() > 0) SetMode(stream_mode_read); |
if (Filename.length() > 0) SetMode(stream_mode_read); |
1475 |
// open the other (new) file for writing and truncate it to zero size |
// open the other (new) file for writing and truncate it to zero size |
1476 |
#if POSIX |
#if POSIX |