2000-09-05 13:16:19 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
#include <fstream>
|
|
|
|
|
|
|
|
//#include <stdio.h>
|
2000-09-05 13:16:19 +00:00
|
|
|
|
|
|
|
#include "support/lyxlib.h"
|
|
|
|
#include "LString.h"
|
2000-09-14 17:53:12 +00:00
|
|
|
//#include "support/syscall.h"
|
2000-09-05 13:16:19 +00:00
|
|
|
#include "support/filetools.h"
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
bool lyx::copy(string const & from, string const & to)
|
2000-09-05 13:16:19 +00:00
|
|
|
{
|
2000-09-14 17:53:12 +00:00
|
|
|
#if 0
|
2000-09-05 13:16:19 +00:00
|
|
|
string command = "cp " + QuoteName(from) + " " + QuoteName(to);
|
|
|
|
return Systemcalls().startscript(Systemcalls::System,
|
|
|
|
command) == 0;
|
2000-09-14 17:53:12 +00:00
|
|
|
#else
|
|
|
|
ifstream ifs(from.c_str());
|
|
|
|
if (!ifs) return false;
|
|
|
|
ofstream ofs(to.c_str(), ios::out|ios::trunc);
|
|
|
|
if (!ofs) return false;
|
|
|
|
ofs << ifs.rdbuf();
|
|
|
|
if (ofs.good()) return true;
|
|
|
|
return false;
|
|
|
|
#endif
|
2000-09-05 13:16:19 +00:00
|
|
|
}
|