Fixed: Preserve files permissions after copying a file
This commit is contained in:
parent
dfb0d70ccf
commit
de4ded9f18
2 changed files with 8 additions and 0 deletions
|
@ -123,6 +123,7 @@ void CFilesCopier::getFilesList(FilesToCopy &files)
|
||||||
file.dst = dstPath;
|
file.dst = dstPath;
|
||||||
file.size = entry.size();
|
file.size = entry.size();
|
||||||
file.date = entry.lastModified().toTime_t();
|
file.date = entry.lastModified().toTime_t();
|
||||||
|
file.permissions = entry.permissions();
|
||||||
|
|
||||||
files << file;
|
files << file;
|
||||||
}
|
}
|
||||||
|
@ -141,6 +142,7 @@ void CFilesCopier::getFilesList(FilesToCopy &files)
|
||||||
file.dst = m_destinationDirectory + "/" + fileInfo.fileName();
|
file.dst = m_destinationDirectory + "/" + fileInfo.fileName();
|
||||||
file.size = fileInfo.size();
|
file.size = fileInfo.size();
|
||||||
file.date = fileInfo.lastModified().toTime_t();
|
file.date = fileInfo.lastModified().toTime_t();
|
||||||
|
file.permissions = fileInfo.permissions();
|
||||||
|
|
||||||
files << file;
|
files << file;
|
||||||
}
|
}
|
||||||
|
@ -187,6 +189,11 @@ bool CFilesCopier::copyFiles(const FilesToCopy &files)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!QFile::setPermissions(file.dst, file.permissions))
|
||||||
|
{
|
||||||
|
qDebug() << "Unable to change permissions of " << file.dst;
|
||||||
|
}
|
||||||
|
|
||||||
if (!NLMISC::CFile::setFileModificationDate(qToUtf8(file.dst), file.date))
|
if (!NLMISC::CFile::setFileModificationDate(qToUtf8(file.dst), file.date))
|
||||||
{
|
{
|
||||||
qDebug() << "Unable to change date of " << file.dst;
|
qDebug() << "Unable to change date of " << file.dst;
|
||||||
|
|
|
@ -49,6 +49,7 @@ protected:
|
||||||
QString dst;
|
QString dst;
|
||||||
qint64 size;
|
qint64 size;
|
||||||
uint date;
|
uint date;
|
||||||
|
QFile::Permissions permissions;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef QList<FileToCopy> FilesToCopy;
|
typedef QList<FileToCopy> FilesToCopy;
|
||||||
|
|
Loading…
Reference in a new issue