]> git.lyx.org Git - lyx.git/blobdiff - src/support/copy.C
remove NO_PEXTRA_STUFF
[lyx.git] / src / support / copy.C
index 7324d445681efc00ab011cf22b5a32e9714fb75f..b89f2159494aa836f937e62e6292c69778ed059e 100644 (file)
@@ -2,26 +2,24 @@
 
 #include <fstream>
 
-//#include <stdio.h>
-
 #include "support/lyxlib.h"
 #include "LString.h"
-//#include "support/syscall.h"
-#include "support/filetools.h"
+
+using std::ifstream;
+using std::ofstream;
+using std::ios;
 
 bool lyx::copy(string const & from, string const & to)
 {
-#if 0
-       string command = "cp " + QuoteName(from) + " " + QuoteName(to);
-       return Systemcalls().startscript(Systemcalls::System,
-                                        command) == 0;
-#else
-       std::ifstream ifs(from.c_str());
-       if (!ifs) return false;
-       std::ofstream ofs(to.c_str(), std::ios::out|std::ios::trunc);
-       if (!ofs) return false;
+       ifstream ifs(from.c_str());
+       if (!ifs)
+               return false;
+       ofstream ofs(to.c_str(),
+                    ios::binary | ios::out | ios::trunc);
+       if (!ofs)
+               return false;
        ofs << ifs.rdbuf();
-       if (ofs.good()) return true;
+       if (ofs.good())
+               return true;
        return false;
-#endif
 }