зеркало из https://github.com/nextcloud/desktop.git
Fixes after rebase to master
- use vfs suffix in ProcessDirectoryJob - fix include vfs.h - fix local vio passing vfs - fix checksum computation - vfs mode use - mingw lambda compile issue
This commit is contained in:
Родитель
2b20985875
Коммит
0f2ef42ba2
|
@ -22,10 +22,13 @@
|
|||
#define _CSYNC_VIO_LOCAL_H
|
||||
|
||||
struct csync_vio_handle_t;
|
||||
namespace OCC {
|
||||
class Vfs;
|
||||
}
|
||||
|
||||
csync_vio_handle_t OCSYNC_EXPORT *csync_vio_local_opendir(const QString &name);
|
||||
int OCSYNC_EXPORT csync_vio_local_closedir(csync_vio_handle_t *dhandle);
|
||||
std::unique_ptr<csync_file_stat_t> OCSYNC_EXPORT csync_vio_local_readdir(CSYNC *ctx, csync_vio_handle_t *dhandle);
|
||||
std::unique_ptr<csync_file_stat_t> OCSYNC_EXPORT csync_vio_local_readdir(csync_vio_handle_t *dhandle, OCC::Vfs *vfs);
|
||||
|
||||
int OCSYNC_EXPORT csync_vio_local_stat(const char *uri, csync_file_stat_t *buf);
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include "csync_util.h"
|
||||
|
||||
#include "vio/csync_vio_local.h"
|
||||
#include "common/vfsplugin.h"
|
||||
#include "common/vfs.h"
|
||||
|
||||
#include <QtCore/QLoggingCategory>
|
||||
#include <QtCore/QFile>
|
||||
|
@ -74,7 +74,7 @@ int csync_vio_local_closedir(csync_vio_handle_t *dhandle) {
|
|||
return rc;
|
||||
}
|
||||
|
||||
std::unique_ptr<csync_file_stat_t> csync_vio_local_readdir(CSYNC *ctx, csync_vio_handle_t *handle) {
|
||||
std::unique_ptr<csync_file_stat_t> csync_vio_local_readdir(csync_vio_handle_t *handle, OCC::Vfs *vfs) {
|
||||
|
||||
struct _tdirent *dirent = NULL;
|
||||
std::unique_ptr<csync_file_stat_t> file_stat;
|
||||
|
@ -123,8 +123,8 @@ std::unique_ptr<csync_file_stat_t> csync_vio_local_readdir(CSYNC *ctx, csync_vio
|
|||
}
|
||||
|
||||
// Override type for virtual files if desired
|
||||
if (ctx->vfs)
|
||||
ctx->vfs->statTypeVirtualFile(file_stat.get(), nullptr);
|
||||
if (vfs)
|
||||
vfs->statTypeVirtualFile(file_stat.get(), nullptr);
|
||||
|
||||
return file_stat;
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ static time_t FileTimeToUnixTime(FILETIME *filetime, DWORD *remainder)
|
|||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<csync_file_stat_t> csync_vio_local_readdir(CSYNC *ctx, csync_vio_handle_t *handle) {
|
||||
std::unique_ptr<csync_file_stat_t> csync_vio_local_readdir(csync_vio_handle_t *handle, OCC::Vfs *vfs) {
|
||||
|
||||
std::unique_ptr<csync_file_stat_t> file_stat;
|
||||
DWORD rem;
|
||||
|
@ -139,12 +139,12 @@ std::unique_ptr<csync_file_stat_t> csync_vio_local_readdir(CSYNC *ctx, csync_vio
|
|||
}
|
||||
auto path = c_utf8_from_locale(handle->ffd.cFileName);
|
||||
if (path == "." || path == "..")
|
||||
return csync_vio_local_readdir(ctx, handle);
|
||||
return csync_vio_local_readdir(handle, vfs);
|
||||
|
||||
file_stat = std::make_unique<csync_file_stat_t>();
|
||||
file_stat->path = path;
|
||||
|
||||
if (ctx->vfs && ctx->vfs->statTypeVirtualFile(file_stat.get(), &handle->ffd)) {
|
||||
if (vfs && vfs->statTypeVirtualFile(file_stat.get(), &handle->ffd)) {
|
||||
// all good
|
||||
} else if (handle->ffd.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) {
|
||||
// Detect symlinks, and treat junctions as symlinks too.
|
||||
|
|
|
@ -394,7 +394,8 @@ void ProcessDirectoryJob::processFileAnalyzeRemoteInfo(
|
|||
return;
|
||||
}
|
||||
// Turn new remote files into virtual files if the option is enabled.
|
||||
if (!localEntry.isValid() && _discoveryData->_syncOptions._newFilesAreVirtual && item->_type == ItemTypeFile) {
|
||||
auto vfs = _discoveryData->_syncOptions._vfs;
|
||||
if (!localEntry.isValid() && vfs && vfs->mode() == Vfs::WithSuffix && item->_type == ItemTypeFile) {
|
||||
item->_type = ItemTypeVirtualFile;
|
||||
addVirtualFileSuffix(path._original);
|
||||
}
|
||||
|
@ -1151,12 +1152,15 @@ void ProcessDirectoryJob::dbError()
|
|||
|
||||
void ProcessDirectoryJob::addVirtualFileSuffix(QString &str) const
|
||||
{
|
||||
str.append(_discoveryData->_syncOptions._virtualFileSuffix);
|
||||
if (auto vfs = _discoveryData->_syncOptions._vfs)
|
||||
str.append(vfs->fileSuffix());
|
||||
}
|
||||
|
||||
bool ProcessDirectoryJob::hasVirtualFileSuffix(const QString &str) const
|
||||
{
|
||||
return str.endsWith(_discoveryData->_syncOptions._virtualFileSuffix);
|
||||
if (auto vfs = _discoveryData->_syncOptions._vfs)
|
||||
return str.endsWith(vfs->fileSuffix());
|
||||
return false;
|
||||
}
|
||||
|
||||
void ProcessDirectoryJob::chopVirtualFileSuffix(QString &str) const
|
||||
|
@ -1164,7 +1168,7 @@ void ProcessDirectoryJob::chopVirtualFileSuffix(QString &str) const
|
|||
bool hasSuffix = hasVirtualFileSuffix(str);
|
||||
ASSERT(hasSuffix);
|
||||
if (hasSuffix)
|
||||
str.chop(_discoveryData->_syncOptions._virtualFileSuffix.size());
|
||||
str.chop(_discoveryData->_syncOptions._vfs->fileSuffix().size());
|
||||
}
|
||||
|
||||
DiscoverySingleDirectoryJob *ProcessDirectoryJob::startAsyncServerQuery()
|
||||
|
@ -1246,7 +1250,7 @@ bool ProcessDirectoryJob::runLocalQuery()
|
|||
return false;
|
||||
}
|
||||
errno = 0;
|
||||
while (auto dirent = csync_vio_local_readdir(dh)) {
|
||||
while (auto dirent = csync_vio_local_readdir(dh, _discoveryData->_syncOptions._vfs)) {
|
||||
if (dirent->type == ItemTypeSkip)
|
||||
continue;
|
||||
LocalInfo i;
|
||||
|
|
|
@ -196,7 +196,8 @@ static void traverse_dir(void **state, const char *dir, int *cnt)
|
|||
dh = csync_vio_local_opendir(dir);
|
||||
assert_non_null(dh);
|
||||
|
||||
while( (dirent = csync_vio_local_readdir(dh)) ) {
|
||||
OCC::Vfs *vfs = nullptr;
|
||||
while( (dirent = csync_vio_local_readdir(dh, vfs)) ) {
|
||||
assert_non_null(dirent.get());
|
||||
if (!dirent->original_path.isEmpty()) {
|
||||
sv->ignored_dir = c_strdup(dirent->original_path);
|
||||
|
|
Загрузка…
Ссылка в новой задаче