MCPcopy Create free account
hub / github.com/RGAA-Software/GoDesk / FileSystemObject

Method FileSystemObject

src/client/transfer/fs_object.cpp:16–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14{
15
16 FileSystemObject::FileSystemObject(const QString& file_path, int read_block_size) {
17 if (File::IsFolder(file_path.toStdString())) {
18 is_folder_ = true;
19 folder_path_ = file_path;
20 auto dir_name = QDir(folder_path_).dirName();
21 LOGI("** Folder Path: {}", folder_path_.toStdString());
22 FolderUtil::VisitAllByQt(file_path.toStdString(), [=, this](VisitResult&& result) {
23 auto abs_file_path = QString::fromStdWString(result.path_);
24 auto filename = QString::fromStdWString(result.name_);
25 auto file = std::make_shared<FsFile>(abs_file_path, read_block_size);
26 auto start_idx = folder_path_.size()+1;
27 file->ref_path_ = dir_name + "/" + abs_file_path.mid(start_idx);
28 file->ref_folder_ = dir_name + "/" + abs_file_path.mid(start_idx, abs_file_path.size()-filename.size()-start_idx).trimmed();
29 file->base_folder_name_ = dir_name;
30 fs_files_.push_back(file);
31 LOGI("Name: {}, Path: {}", QString::fromStdWString(result.name_).toStdString(), abs_file_path.toStdString());
32 LOGI("Ref path: {}, Ref folder: {}", file->ref_path_.toStdString(), file->ref_folder_.toStdString());
33 });
34
35 } else {
36 fs_file_ = std::make_shared<FsFile>(file_path, read_block_size);
37 }
38 }
39
40 bool FileSystemObject::IsFolder() const {
41 return is_folder_;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected