#include "mainwindow.h"
#include <QApplication>
#include <QDir>
int main(int argc, char *argv[])
{
QString dbsrcfilepath
= "/Users/user/build-learnOn-Desktop_Qt_5_4_0_clang_64bit-Debug/learnOn.app/Contents/MacOS/learnOn1.sqlite";
dbsrcfilepath
= QDir::toNativeSeparators(dbsrcfilepath
);
destifile.setFileName(dbsrcfilepath);
if(!(QDir("/Users/user/learnOnContent/").
exists())) QDir().
mkdir("/Users/user/learnOnContent/");
QString dbdestinationfilepath
= "/Users/user/learnOnContent/learnOn.sqlite";
dbdestinationfilepath
= QDir::toNativeSeparators(dbdestinationfilepath
);
srcfile.setFileName(dbdestinationfilepath);
if(!srcfile.exists())
{
bool success = true;
success
&= destifile.
open( QFile::ReadOnly );
success
&= srcfile.
open( QFile::WriteOnly |
QFile::Truncate );
success &= srcfile.write( destifile.readAll() ) >= 0;
destifile.close();
srcfile.close();
}
else
{
srcfile.copy(dbdestinationfilepath);
}
return a.exec();
}
#include "mainwindow.h"
#include <QApplication>
#include <QDir>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QDir qd;
QFile srcfile;
QFile destifile;
QString dbsrcfilepath = "/Users/user/build-learnOn-Desktop_Qt_5_4_0_clang_64bit-Debug/learnOn.app/Contents/MacOS/learnOn1.sqlite";
dbsrcfilepath = QDir::toNativeSeparators(dbsrcfilepath);
destifile.setFileName(dbsrcfilepath);
if(!(QDir("/Users/user/learnOnContent/").exists()))
QDir().mkdir("/Users/user/learnOnContent/");
QString dbdestinationfilepath = "/Users/user/learnOnContent/learnOn.sqlite";
dbdestinationfilepath = QDir::toNativeSeparators(dbdestinationfilepath);
srcfile.setFileName(dbdestinationfilepath);
if(!srcfile.exists())
{
bool success = true;
success &= destifile.open( QFile::ReadOnly );
success &= srcfile.open( QFile::WriteOnly | QFile::Truncate );
success &= srcfile.write( destifile.readAll() ) >= 0;
destifile.close();
srcfile.close();
}
else
{
srcfile.copy(dbdestinationfilepath);
}
return a.exec();
}
To copy to clipboard, switch view to plain text mode
copying from dbsrcfilepath to dbdestinationfilepath
Bookmarks