@cetapod/react-native-smb 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/README.md +72 -0
- package/ReactNativeSmb.podspec +59 -0
- package/cpp/ios/OnLoad.mm +24 -0
- package/cpp/shared/HybridSMB.cpp +324 -0
- package/cpp/shared/HybridSMB.hpp +102 -0
- package/cpp/shared/ReactNativeSmb.hpp +428 -0
- package/cpp/shared/connection/ContextRequest.hpp +27 -0
- package/cpp/shared/connection/ContextRequestQueue.cpp +85 -0
- package/cpp/shared/connection/ContextRequestQueue.hpp +28 -0
- package/cpp/shared/connection/MetadataContextLease.hpp +33 -0
- package/cpp/shared/connection/PoolContextHandle.cpp +35 -0
- package/cpp/shared/connection/PoolContextHandle.hpp +44 -0
- package/cpp/shared/connection/PoolSlot.cpp +73 -0
- package/cpp/shared/connection/PoolSlot.hpp +46 -0
- package/cpp/shared/connection/PoolTypes.hpp +41 -0
- package/cpp/shared/connection/SmbConnection.cpp +385 -0
- package/cpp/shared/connection/SmbConnection.hpp +93 -0
- package/cpp/shared/connection/SmbConnectionPool.cpp +316 -0
- package/cpp/shared/connection/SmbConnectionPool.hpp +84 -0
- package/cpp/shared/core/CancellationToken.hpp +22 -0
- package/cpp/shared/core/OperatorContext.hpp +24 -0
- package/cpp/shared/core/SmbEnums.hpp +126 -0
- package/cpp/shared/core/SmbTask.cpp +131 -0
- package/cpp/shared/core/SmbTask.hpp +52 -0
- package/cpp/shared/core/SmbTaskCore.cpp +222 -0
- package/cpp/shared/core/SmbTaskCore.hpp +107 -0
- package/cpp/shared/core/SmbTypes.hpp +35 -0
- package/cpp/shared/core/TaskObserverHub.cpp +166 -0
- package/cpp/shared/core/TaskObserverHub.hpp +66 -0
- package/cpp/shared/core/TaskSnapshotCodec.cpp +32 -0
- package/cpp/shared/core/TaskSnapshotCodec.hpp +41 -0
- package/cpp/shared/io/SmbCopyTree.hpp +114 -0
- package/cpp/shared/io/SmbDirScan.hpp +80 -0
- package/cpp/shared/io/SmbFileIO.cpp +1355 -0
- package/cpp/shared/io/SmbFileIO.hpp +45 -0
- package/cpp/shared/io/SmbPathUtil.hpp +75 -0
- package/cpp/shared/io/SmbSecurity.cpp +308 -0
- package/cpp/shared/io/SmbSecurity.hpp +32 -0
- package/cpp/shared/io/SmbTreeOps.hpp +112 -0
- package/cpp/shared/operators/Operator.hpp +35 -0
- package/cpp/shared/operators/OperatorBase.cpp +57 -0
- package/cpp/shared/operators/OperatorBase.hpp +57 -0
- package/cpp/shared/operators/connection/ConnectOperator.cpp +19 -0
- package/cpp/shared/operators/connection/ConnectOperator.hpp +22 -0
- package/cpp/shared/operators/connection/ConnectShareOperator.cpp +19 -0
- package/cpp/shared/operators/connection/ConnectShareOperator.hpp +21 -0
- package/cpp/shared/operators/connection/DisconnectOperator.cpp +12 -0
- package/cpp/shared/operators/connection/DisconnectOperator.hpp +15 -0
- package/cpp/shared/operators/connection/InitializeOperator.cpp +12 -0
- package/cpp/shared/operators/connection/InitializeOperator.hpp +22 -0
- package/cpp/shared/operators/connection/ListSharesOperator.cpp +13 -0
- package/cpp/shared/operators/connection/ListSharesOperator.hpp +18 -0
- package/cpp/shared/operators/listing/GetPathInfoOperator.cpp +43 -0
- package/cpp/shared/operators/listing/GetPathInfoOperator.hpp +21 -0
- package/cpp/shared/operators/listing/GetSecurityDescriptorOperator.cpp +202 -0
- package/cpp/shared/operators/listing/GetSecurityDescriptorOperator.hpp +22 -0
- package/cpp/shared/operators/listing/ListDirectoryOperator.cpp +20 -0
- package/cpp/shared/operators/listing/ListDirectoryOperator.hpp +24 -0
- package/cpp/shared/operators/mutate/CopyItemOperator.cpp +19 -0
- package/cpp/shared/operators/mutate/CopyItemOperator.hpp +25 -0
- package/cpp/shared/operators/mutate/CreateDirectoryOperator.cpp +28 -0
- package/cpp/shared/operators/mutate/CreateDirectoryOperator.hpp +20 -0
- package/cpp/shared/operators/mutate/DeleteItemOperator.cpp +96 -0
- package/cpp/shared/operators/mutate/DeleteItemOperator.hpp +23 -0
- package/cpp/shared/operators/mutate/DuplicateItemOperator.cpp +48 -0
- package/cpp/shared/operators/mutate/DuplicateItemOperator.hpp +23 -0
- package/cpp/shared/operators/mutate/MoveItemOperator.cpp +32 -0
- package/cpp/shared/operators/mutate/MoveItemOperator.hpp +21 -0
- package/cpp/shared/operators/mutate/RenameItemOperator.cpp +37 -0
- package/cpp/shared/operators/mutate/RenameItemOperator.hpp +21 -0
- package/cpp/shared/operators/transfer/DownloadFileOperator.cpp +31 -0
- package/cpp/shared/operators/transfer/DownloadFileOperator.hpp +21 -0
- package/cpp/shared/operators/transfer/UploadFileOperator.cpp +27 -0
- package/cpp/shared/operators/transfer/UploadFileOperator.hpp +21 -0
- package/cpp/shared/util/SmbErrorMapper.hpp +229 -0
- package/cpp/shared/util/SmbLog.hpp +20 -0
- package/docs/API.md +105 -0
- package/docs/ARCHITECTURE.md +70 -0
- package/docs/TASK_MODEL.md +149 -0
- package/ios/include/smb2/libsmb2-dcerpc-lsa.h +172 -0
- package/ios/include/smb2/libsmb2-dcerpc-srvsvc.h +180 -0
- package/ios/include/smb2/libsmb2-dcerpc.h +155 -0
- package/ios/include/smb2/libsmb2-raw.h +497 -0
- package/ios/include/smb2/libsmb2.h +1384 -0
- package/ios/include/smb2/smb2-errors.h +549 -0
- package/ios/include/smb2/smb2.h +1251 -0
- package/ios/libs/device/libsmb2-device.a +0 -0
- package/ios/libs/libsmb2.xcframework/Info.plist +48 -0
- package/ios/libs/libsmb2.xcframework/ios-arm64/Headers/smb2/libsmb2-dcerpc-lsa.h +172 -0
- package/ios/libs/libsmb2.xcframework/ios-arm64/Headers/smb2/libsmb2-dcerpc-srvsvc.h +180 -0
- package/ios/libs/libsmb2.xcframework/ios-arm64/Headers/smb2/libsmb2-dcerpc.h +155 -0
- package/ios/libs/libsmb2.xcframework/ios-arm64/Headers/smb2/libsmb2-raw.h +497 -0
- package/ios/libs/libsmb2.xcframework/ios-arm64/Headers/smb2/libsmb2.h +1384 -0
- package/ios/libs/libsmb2.xcframework/ios-arm64/Headers/smb2/smb2-errors.h +549 -0
- package/ios/libs/libsmb2.xcframework/ios-arm64/Headers/smb2/smb2.h +1251 -0
- package/ios/libs/libsmb2.xcframework/ios-arm64/libsmb2.a +0 -0
- package/ios/libs/libsmb2.xcframework/ios-arm64_x86_64-simulator/Headers/smb2/libsmb2-dcerpc-lsa.h +172 -0
- package/ios/libs/libsmb2.xcframework/ios-arm64_x86_64-simulator/Headers/smb2/libsmb2-dcerpc-srvsvc.h +180 -0
- package/ios/libs/libsmb2.xcframework/ios-arm64_x86_64-simulator/Headers/smb2/libsmb2-dcerpc.h +155 -0
- package/ios/libs/libsmb2.xcframework/ios-arm64_x86_64-simulator/Headers/smb2/libsmb2-raw.h +497 -0
- package/ios/libs/libsmb2.xcframework/ios-arm64_x86_64-simulator/Headers/smb2/libsmb2.h +1384 -0
- package/ios/libs/libsmb2.xcframework/ios-arm64_x86_64-simulator/Headers/smb2/smb2-errors.h +549 -0
- package/ios/libs/libsmb2.xcframework/ios-arm64_x86_64-simulator/Headers/smb2/smb2.h +1251 -0
- package/ios/libs/libsmb2.xcframework/ios-arm64_x86_64-simulator/libsmb2.a +0 -0
- package/ios/libs/simulator/libsmb2-simulator.a +0 -0
- package/lib/ReactNativeSmb.d.ts +200 -0
- package/lib/ReactNativeSmb.js +1 -0
- package/lib/bridge/decode.d.ts +4 -0
- package/lib/bridge/decode.js +92 -0
- package/lib/core/SMB.d.ts +3 -0
- package/lib/core/SMB.js +4 -0
- package/lib/core/SmbClient.d.ts +35 -0
- package/lib/core/SmbClient.js +99 -0
- package/lib/core/SmbTask.d.ts +41 -0
- package/lib/core/SmbTask.js +74 -0
- package/lib/core/TransferStore.d.ts +22 -0
- package/lib/core/TransferStore.js +88 -0
- package/lib/core/ids.d.ts +1 -0
- package/lib/core/ids.js +3 -0
- package/lib/core/taskResult.d.ts +3 -0
- package/lib/core/taskResult.js +52 -0
- package/lib/hooks/useSubscribe.d.ts +20 -0
- package/lib/hooks/useSubscribe.js +36 -0
- package/lib/hooks/useTransfers.d.ts +7 -0
- package/lib/hooks/useTransfers.js +29 -0
- package/lib/index.d.ts +7 -0
- package/lib/index.js +7 -0
- package/lib/labels.d.ts +6 -0
- package/lib/labels.js +71 -0
- package/lib/types.d.ts +141 -0
- package/lib/types.js +59 -0
- package/lib/utils.d.ts +79 -0
- package/lib/utils.js +153 -0
- package/package.json +63 -0
- package/scripts/build-libsmb2.sh +143 -0
- package/scripts/create-xcframework.sh +84 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <string>
|
|
4
|
+
#include <unordered_map>
|
|
5
|
+
|
|
6
|
+
#include "SmbTypes.hpp"
|
|
7
|
+
|
|
8
|
+
namespace react_native_smb {
|
|
9
|
+
|
|
10
|
+
// Single source of truth for the SmbTaskState -> Nitro string-map projection.
|
|
11
|
+
// The TS decoder (src/bridge/decode.ts) mirrors these key names.
|
|
12
|
+
class TaskSnapshotCodec {
|
|
13
|
+
public:
|
|
14
|
+
struct Keys {
|
|
15
|
+
static constexpr const char* exists = "exists"; // "1" / "0" sentinel for getTask
|
|
16
|
+
static constexpr const char* taskId = "taskId";
|
|
17
|
+
static constexpr const char* kind = "kind"; // int(SmbOperatorKind)
|
|
18
|
+
static constexpr const char* operation = "operation"; // debug only; TS ignores
|
|
19
|
+
static constexpr const char* status = "status"; // int(SmbTaskStatus)
|
|
20
|
+
static constexpr const char* determinate = "determinate";
|
|
21
|
+
static constexpr const char* progress = "progress";
|
|
22
|
+
static constexpr const char* errorCode = "errorCode";
|
|
23
|
+
static constexpr const char* errorMessage = "errorMessage";
|
|
24
|
+
static constexpr const char* sourcePath = "sourcePath";
|
|
25
|
+
static constexpr const char* destinationPath = "destinationPath";
|
|
26
|
+
static constexpr const char* bytesDone = "bytesDone";
|
|
27
|
+
static constexpr const char* totalBytes = "totalBytes";
|
|
28
|
+
static constexpr const char* bytesPerSecond = "bytesPerSecond";
|
|
29
|
+
static constexpr const char* etaSeconds = "etaSeconds";
|
|
30
|
+
static constexpr const char* startedAt = "startedAt";
|
|
31
|
+
static constexpr const char* updatedAt = "updatedAt";
|
|
32
|
+
static constexpr const char* endedAt = "endedAt";
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
static std::unordered_map<std::string, std::string> encode(const SmbTaskState& s);
|
|
36
|
+
|
|
37
|
+
// Sentinel map for "task not found".
|
|
38
|
+
static std::unordered_map<std::string, std::string> notFound();
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
} // namespace react_native_smb
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <smb2/libsmb2.h>
|
|
4
|
+
#include <smb2/smb2.h>
|
|
5
|
+
|
|
6
|
+
#include <functional>
|
|
7
|
+
#include <memory>
|
|
8
|
+
#include <optional>
|
|
9
|
+
#include <stdexcept>
|
|
10
|
+
#include <string>
|
|
11
|
+
#include <vector>
|
|
12
|
+
|
|
13
|
+
#include "../ReactNativeSmb.hpp"
|
|
14
|
+
#include "../connection/MetadataContextLease.hpp"
|
|
15
|
+
#include "../connection/SmbConnectionPool.hpp"
|
|
16
|
+
#include "../core/CancellationToken.hpp"
|
|
17
|
+
#include "../core/SmbEnums.hpp"
|
|
18
|
+
#include "SmbFileIO.hpp"
|
|
19
|
+
#include "SmbDirScan.hpp"
|
|
20
|
+
#include "SmbPathUtil.hpp"
|
|
21
|
+
#include "SmbTreeOps.hpp"
|
|
22
|
+
#include "../util/SmbLog.hpp"
|
|
23
|
+
|
|
24
|
+
namespace react_native_smb {
|
|
25
|
+
|
|
26
|
+
inline void copyTreeImpl(SmbConnectionPool& pool, SmbOperatorKind kind, const std::string& fromPath, const std::string& toPath, bool recursive,
|
|
27
|
+
const CancellationToken& cancel, const std::function<void(double, double)>& onProgress,
|
|
28
|
+
const std::function<void(int64_t)>& onExpectedBytes, const std::string& taskId = "",
|
|
29
|
+
MetadataContextLease* sharedLease = nullptr) {
|
|
30
|
+
const std::string normFrom = path_util::normalized(fromPath);
|
|
31
|
+
|
|
32
|
+
std::optional<MetadataContextLease> ownedLease;
|
|
33
|
+
if (!sharedLease) {
|
|
34
|
+
ownedLease.emplace(pool, kind, taskId);
|
|
35
|
+
sharedLease = &*ownedLease;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
bool isDirectory = false;
|
|
39
|
+
int64_t totalSize = 0;
|
|
40
|
+
sharedLease->submitSync([&](smb2_context* ctx) {
|
|
41
|
+
struct smb2_stat_64 st;
|
|
42
|
+
if (smb2_stat(ctx, normFrom.c_str(), &st) < 0) {
|
|
43
|
+
throw std::runtime_error("Copy Failed: Could not stat source '" + fromPath + "'. Error: " + smb2_get_error(ctx));
|
|
44
|
+
}
|
|
45
|
+
isDirectory = (st.smb2_type & SMB2_TYPE_DIRECTORY) != 0;
|
|
46
|
+
totalSize = tree_ops::calculateTotalSize(ctx, fromPath, isDirectory && recursive, cancel);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
auto totalBytesCopied = std::make_shared<int64_t>(0);
|
|
50
|
+
if (onExpectedBytes) onExpectedBytes(totalSize);
|
|
51
|
+
if (onProgress) onProgress(0.0, static_cast<double>(totalSize));
|
|
52
|
+
|
|
53
|
+
if (!isDirectory) {
|
|
54
|
+
sharedLease->submitSync([&](smb2_context* ctx) {
|
|
55
|
+
SMB_LOG("CopyTree file taskId=%s from=%s to=%s", taskId.c_str(), fromPath.c_str(), toPath.c_str());
|
|
56
|
+
smbCopyFileAsync(ctx, path_util::normalized(fromPath), path_util::normalized(toPath), totalBytesCopied, totalSize, onProgress, cancel);
|
|
57
|
+
});
|
|
58
|
+
if (onProgress) onProgress(static_cast<double>(totalSize), static_cast<double>(totalSize));
|
|
59
|
+
SMB_LOG("CopyTree finish taskId=%s copiedBytes=%lld totalBytes=%lld cancelled=%d", taskId.c_str(), static_cast<long long>(*totalBytesCopied),
|
|
60
|
+
static_cast<long long>(totalSize), cancel.cancelled() ? 1 : 0);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
struct CopyJob {
|
|
65
|
+
std::string src;
|
|
66
|
+
std::string dst;
|
|
67
|
+
int64_t size;
|
|
68
|
+
};
|
|
69
|
+
std::vector<CopyJob> files;
|
|
70
|
+
const std::string normToRoot = path_util::normalized(toPath);
|
|
71
|
+
sharedLease->submitSync([&](smb2_context* ctx) {
|
|
72
|
+
const int mk = smb2_mkdir(ctx, normToRoot.c_str());
|
|
73
|
+
if (mk < 0) throw std::runtime_error("Failed to create destination directory: " + std::string(smb2_get_error(ctx)));
|
|
74
|
+
if (!recursive) return;
|
|
75
|
+
|
|
76
|
+
std::function<void(const std::string&, const std::string&)> walk = [&](const std::string& srcDir, const std::string& dstDir) {
|
|
77
|
+
if (cancel.cancelled()) return;
|
|
78
|
+
std::vector<SmbFileInfo> contents = listOnCtx(ctx, srcDir, false, 0, cancel);
|
|
79
|
+
for (const auto& item : contents) {
|
|
80
|
+
if (cancel.cancelled()) return;
|
|
81
|
+
std::string destItem = path_util::buildUrl(dstDir, item.name);
|
|
82
|
+
if (item.isDirectory) {
|
|
83
|
+
std::string normDest = path_util::normalized(destItem);
|
|
84
|
+
const int r = smb2_mkdir(ctx, normDest.c_str());
|
|
85
|
+
if (r < 0) throw std::runtime_error("Failed to create destination directory: " + std::string(smb2_get_error(ctx)));
|
|
86
|
+
walk(item.path, destItem);
|
|
87
|
+
} else {
|
|
88
|
+
files.push_back({item.path, destItem, item.size});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
walk(fromPath, toPath);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
if (cancel.cancelled() || files.empty()) {
|
|
96
|
+
SMB_LOG("CopyTree finish taskId=%s reason=%s", taskId.c_str(), cancel.cancelled() ? "cancelled" : "empty");
|
|
97
|
+
if (onProgress) onProgress(static_cast<double>(totalSize), static_cast<double>(totalSize));
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
for (const auto& job : files) {
|
|
102
|
+
if (cancel.cancelled()) break;
|
|
103
|
+
sharedLease->submitSync([&](smb2_context* ctx) {
|
|
104
|
+
SMB_LOG("CopyTree file taskId=%s from=%s to=%s size=%lld", taskId.c_str(), job.src.c_str(), job.dst.c_str(), static_cast<long long>(job.size));
|
|
105
|
+
smbCopyFileAsync(ctx, path_util::normalized(job.src), path_util::normalized(job.dst), totalBytesCopied, totalSize, onProgress, cancel);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
SMB_LOG("CopyTree finish taskId=%s copiedBytes=%lld totalBytes=%lld cancelled=%d", taskId.c_str(), static_cast<long long>(*totalBytesCopied),
|
|
110
|
+
static_cast<long long>(totalSize), cancel.cancelled() ? 1 : 0);
|
|
111
|
+
if (onProgress) onProgress(static_cast<double>(totalSize), static_cast<double>(totalSize));
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
} // namespace react_native_smb
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <smb2/libsmb2.h>
|
|
4
|
+
#include <smb2/smb2.h>
|
|
5
|
+
|
|
6
|
+
#include <stdexcept>
|
|
7
|
+
#include <string>
|
|
8
|
+
#include <vector>
|
|
9
|
+
|
|
10
|
+
#include "../ReactNativeSmb.hpp" // SmbFileInfo
|
|
11
|
+
#include "../core/CancellationToken.hpp"
|
|
12
|
+
#include "SmbPathUtil.hpp"
|
|
13
|
+
|
|
14
|
+
namespace react_native_smb {
|
|
15
|
+
|
|
16
|
+
// Directory listing on a single smb2_context. Does not use the connection pool.
|
|
17
|
+
inline std::vector<SmbFileInfo> listOnCtx(smb2_context* ctx, const std::string& path, bool recursive, int maxDepth, const CancellationToken& cancel) {
|
|
18
|
+
std::vector<SmbFileInfo> files;
|
|
19
|
+
const std::string norm = path_util::normalized(path);
|
|
20
|
+
|
|
21
|
+
smb2dir* dir = smb2_opendir(ctx, norm.c_str());
|
|
22
|
+
if (!dir) {
|
|
23
|
+
throw std::runtime_error(std::string("List Directory Failed: Could not open directory '") + path + "'. Error: " + smb2_get_error(ctx));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
struct smb2dirent* ent;
|
|
28
|
+
while ((ent = smb2_readdir(ctx, dir))) {
|
|
29
|
+
if (cancel.cancelled()) {
|
|
30
|
+
smb2_closedir(ctx, dir);
|
|
31
|
+
return {};
|
|
32
|
+
}
|
|
33
|
+
std::string name = ent->name;
|
|
34
|
+
if (name == "." || name == "..") continue;
|
|
35
|
+
std::string fullPath = path_util::buildUrl(path, name);
|
|
36
|
+
files.push_back(path_util::makeFileInfo(ent->st, name, fullPath));
|
|
37
|
+
}
|
|
38
|
+
} catch (...) {
|
|
39
|
+
smb2_closedir(ctx, dir);
|
|
40
|
+
throw;
|
|
41
|
+
}
|
|
42
|
+
smb2_closedir(ctx, dir);
|
|
43
|
+
|
|
44
|
+
// Cheap childCount per directory (opendir/readdir count, no per-entry stat).
|
|
45
|
+
for (auto& item : files) {
|
|
46
|
+
if (!item.isDirectory) continue;
|
|
47
|
+
if (cancel.cancelled()) return {};
|
|
48
|
+
smb2dir* sub = smb2_opendir(ctx, path_util::normalized(item.path).c_str());
|
|
49
|
+
if (!sub) {
|
|
50
|
+
item.childCount = -1;
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
int64_t count = 0;
|
|
54
|
+
struct smb2dirent* subEnt;
|
|
55
|
+
while ((subEnt = smb2_readdir(ctx, sub))) {
|
|
56
|
+
std::string n = subEnt->name;
|
|
57
|
+
if (n == "." || n == "..") continue;
|
|
58
|
+
++count;
|
|
59
|
+
}
|
|
60
|
+
smb2_closedir(ctx, sub);
|
|
61
|
+
item.childCount = count;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (recursive && maxDepth != 0) {
|
|
65
|
+
for (auto& item : files) {
|
|
66
|
+
if (cancel.cancelled()) return {};
|
|
67
|
+
if (item.isDirectory) {
|
|
68
|
+
try {
|
|
69
|
+
int newMaxDepth = (maxDepth > 0) ? maxDepth - 1 : maxDepth;
|
|
70
|
+
item.children = listOnCtx(ctx, item.path, true, newMaxDepth, cancel);
|
|
71
|
+
} catch (const std::exception&) {
|
|
72
|
+
item.children.clear();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return files;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
} // namespace react_native_smb
|