ossp-pkg/as/as-gui/as_sfile.cpp 1.2 -> 1.3
--- as_sfile.cpp 2003/02/13 21:32:36 1.2
+++ as_sfile.cpp 2003/02/13 21:50:35 1.3
@@ -45,19 +45,18 @@
QTextStream Streambak; // Stream to write to (Filebak)
try {
- Q_ASSERT(!this->exists()); // Conditionally short circuit
+ if(!this->exists()) // Conditionally short circuit if
+ return; // file to backup does not exist
Fname = this->name(); // Copy filename from original
Filein.setName(Fname); // Set filename of original
- if (Filein.exists()) { // Can only backup an existing file
- Filein.open(IO_ReadOnly); // Open original read-only
- Filebak.setName(Fname + ".bak"); // Set filename of backup
- Filebak.open(IO_WriteOnly); // Open backup write-only
- Streamin.setDevice(&Filein); // Set incoming stream
- Streambak.setDevice(&Filebak); // Set outgoing stream
- Streambak << Streamin.read(); // Do actual writing
- Filein.close(); // Close original
- Filebak.close(); // Close backup
- }
+ Filein.open(IO_ReadOnly); // Open original read-only
+ Filebak.setName(Fname + ".bak"); // Set filename of backup
+ Filebak.open(IO_WriteOnly); // Open backup write-only
+ Streamin.setDevice(&Filein); // Set incoming stream
+ Streambak.setDevice(&Filebak); // Set outgoing stream
+ Streambak << Streamin.read(); // Do actual writing
+ Filein.close(); // Close original
+ Filebak.close(); // Close backup
}
catch (Genexcept& Genex) {
Genex.reportErr();
|
|