Logging: Report setModTime failures.

Ths may be helpful for #2252 and maybe even #2431.
This commit is contained in:
Christian Kamm 2014-11-05 13:20:19 +01:00
parent b87931c0a9
commit a49a6bfd88
2 changed files with 9 additions and 3 deletions

View File

@ -96,12 +96,18 @@ time_t FileSystem::getModTime(const QString &filename)
return result;
}
void FileSystem::setModTime(const QString& filename, time_t modTime)
bool FileSystem::setModTime(const QString& filename, time_t modTime)
{
struct timeval times[2];
times[0].tv_sec = times[1].tv_sec = modTime;
times[0].tv_usec = times[1].tv_usec = 0;
c_utimes(filename.toUtf8().data(), times);
int rc = c_utimes(filename.toUtf8().data(), times);
if (rc != 0) {
qDebug() << "Error setting mtime for" << filename
<< "failed: rc" << rc << ", errno:" << errno;
return false;
}
return true;
}
bool FileSystem::renameReplace(const QString& originFileName, const QString& destinationFileName, QString* errorString)

View File

@ -40,7 +40,7 @@ void OWNCLOUDSYNC_EXPORT setFileHidden(const QString& filename, bool hidden);
*/
time_t OWNCLOUDSYNC_EXPORT getModTime(const QString &filename);
void setModTime(const QString &filename, time_t modTime);
bool setModTime(const QString &filename, time_t modTime);
/**
* Rename the file \a originFileName to \a destinationFileName, and overwrite the destination if it