Working on legacy support, incomplete.
This commit is contained in:
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user