if (newFile.exists())
{
fl.failedRename = true;
+ fl.renameError = tr("Rename: Failed to rename file <%1>. Destination <%2> exists.").arg(oldFile.filePath()).arg(newFileString);
db->setFileLocation(fl);
- db->log(tr("Rename: Failed to rename file <%1>. Destination <%2> exists.").arg(oldFile.filePath()).arg(newFileString), 2);
+ db->log(fl.renameError, 2);
continue;
}
if (!QDir().mkpath(newFilePath))
{
fl.failedRename = true;
+ fl.renameError = tr("Rename: Failed to rename file <%1>. Destination path <%2> does not exist and could not be created.").arg(oldFile.filePath()).arg(newFile.canonicalPath());
db->setFileLocation(fl);
- db->log(tr("Rename: Failed to rename file <%1>. Destination path <%2> does not exist and could not be created.").arg(oldFile.filePath()).arg(newFile.canonicalPath()), 2);
+ db->log(fl.renameError, 2);
continue;
}
}
if (!QFileInfo(newFilePath).isWritable())
{
fl.failedRename = true;
+ fl.renameError = tr("Rename: Failed to rename file <%1>. Destination directory <%2> is not writable.").arg(oldFile.canonicalFilePath()).arg(newFile.absolutePath());
db->setFileLocation(fl);
- db->log(tr("Rename: Failed to rename file <%1>. Destination directory <%2> is not writable.").arg(oldFile.canonicalFilePath()).arg(newFile.absolutePath()), 2);
+ db->log(fl.renameError, 2);
continue;
}
if (!oldFile.isWritable())
{
fl.failedRename = true;
+ fl.renameError = tr("Rename: Failed to rename file <%1>. File is not writable.").arg(oldFile.canonicalFilePath());
db->setFileLocation(fl);
- db->log(tr("Rename: Failed to rename file <%1>. File is not writable.").arg(oldFile.canonicalFilePath()), 2);
+ db->log(fl.renameError, 2);
continue;
}
#endif
if (!QFile::rename(oldFile.canonicalFilePath(), newFileString))
{
fl.failedRename = true;
+ fl.renameError = tr("Rename: Failed to rename file <%1>. Failed to rename file to <%2>").arg(oldFile.canonicalFilePath()).arg(newFileString);
db->setFileLocation(fl);
- db->log(tr("Rename: Failed to rename file <%1>. Failed to rename file to <%2>").arg(oldFile.canonicalFilePath()).arg(newFileString), 2);
+ db->log(fl.renameError, 2);
continue;
}
fl.path = newFileString;
fl.failedRename = false;
+ fl.renameError = "";
db->setFileLocation(fl);
db->log(tr("Rename: File <%1> was renamed to <%2>").arg(oldFile.canonicalFilePath()).arg(newFileString));