Working on legacy support, incomplete.

This commit is contained in:
Petr Mrázek
2013-08-14 08:13:41 +02:00
parent ff33d4a1a4
commit 77e8066542
13 changed files with 1061 additions and 0 deletions

View File

@ -31,4 +31,7 @@ LIBUTIL_EXPORT QString DirNameFromString(QString string, QString inDir = ".");
LIBUTIL_EXPORT bool ensurePathExists(QString filenamepath);
LIBUTIL_EXPORT bool copyPath(QString src, QString dst);
#endif // PATHUTILS_H

View File

@ -73,3 +73,22 @@ bool ensurePathExists(QString filenamepath)
return (dir.mkpath ( a.path() ));
}
bool copyPath(QString src, QString dst)
{
QDir dir(src);
if (!dir.exists())
return false;
foreach (QString d, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot))
{
QString dst_path = dst + QDir::separator() + d;
dir.mkpath(dst_path);
copyPath(src+ QDir::separator() + d, dst_path);
}
foreach (QString f, dir.entryList(QDir::Files))
{
QFile::copy(src + QDir::separator() + f, dst + QDir::separator() + f);
}
return true;
}