OSSP CVS Repository

ossp - Difference in ossp-pkg/as/as-gui/as_sfile.cpp versions 1.1 and 1.2
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/as/as-gui/as_sfile.cpp 1.1 -> 1.2

--- as_sfile.cpp 2003/02/08 18:10:09     1.1
+++ as_sfile.cpp 2003/02/13 21:32:36     1.2
@@ -48,14 +48,16 @@
         Q_ASSERT(!this->exists());          // Conditionally short circuit
         Fname = this->name();               // Copy filename from original
         Filein.setName(Fname);              // Set filename of original
-        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
+        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
+        }
     }
     catch (Genexcept& Genex) {
         Genex.reportErr();

CVSTrac 2.0.1