static qint64 getSizeWithCsync(const QString& filename) { qint64 result = 0; csync_vio_file_stat_t* stat = csync_vio_file_stat_new(); if (csync_vio_local_stat(filename.toUtf8().data(), stat) != -1 && (stat->fields & CSYNC_VIO_FILE_STAT_FIELDS_SIZE)) { result = stat->size; } else { qDebug() << "Could not get size time for" << filename << "with csync"; } csync_vio_file_stat_destroy(stat); return result; }
time_t FileSystem::getModTime(const QString &filename) { csync_vio_file_stat_t* stat = csync_vio_file_stat_new(); qint64 result = -1; if (csync_vio_local_stat(filename.toUtf8().data(), stat) != -1 && (stat->fields & CSYNC_VIO_FILE_STAT_FIELDS_MTIME)) { result = stat->mtime; } else { qDebug() << "Could not get modification time for" << filename << "with csync, using QFileInfo"; result = Utility::qDateTimeToTime_t(QFileInfo(filename).lastModified()); } csync_vio_file_stat_destroy(stat); return result; }
int csync_vio_stat(CSYNC *ctx, const char *uri, csync_vio_file_stat_t *buf) { int rc = -1; switch(ctx->replica) { case REMOTE_REPLICA: rc = owncloud_stat(uri, buf); break; case LOCAL_REPLICA: rc = csync_vio_local_stat(uri, buf); if (rc < 0) { CSYNC_LOG(CSYNC_LOG_PRIORITY_ERROR, "Local stat failed, errno %d", errno); } break; default: break; } return rc; }
int csync_vio_stat(CSYNC *ctx, const char *uri, csync_vio_file_stat_t *buf) { int rc = -1; switch(ctx->replica) { case REMOTE_REPLICA: CSYNC_LOG(CSYNC_LOG_PRIORITY_ERROR, "ERROR: Cannot call remote stat, not implemented"); assert(ctx->replica != REMOTE_REPLICA); break; case LOCAL_REPLICA: rc = csync_vio_local_stat(uri, buf); if (rc < 0) { CSYNC_LOG(CSYNC_LOG_PRIORITY_ERROR, "Local stat failed, errno %d for %s", errno, uri); } break; default: break; } return rc; }
int csync_vio_stat(CSYNC *ctx, const char *uri, csync_vio_file_stat_t *buf) { int rc = -1; switch(ctx->replica) { case REMOTE_REPLICA: rc = owncloud_stat(uri, buf); break; case LOCAL_REPLICA: rc = csync_vio_local_stat(uri, buf); if (rc < 0) { CSYNC_LOG(CSYNC_LOG_PRIORITY_ERROR, "Local stat failed, errno %d", errno); } #ifdef _WIN32 else { CSYNC_LOG(CSYNC_LOG_PRIORITY_DEBUG, "Win32: STAT-inode for %s: %llu", uri, buf->inode ); } #endif break; default: break; } return rc; }