add checkDir arg

This commit is contained in:
uncor3
2026-01-04 22:16:39 +00:00
parent e8fec8d227
commit b77788f492
4 changed files with 12 additions and 9 deletions
+7 -4
View File
@@ -24,7 +24,8 @@
#include <libimobiledevice/lockdown.h>
#include <string.h>
AFCFileTree get_file_tree(afc_client_t afcClient, const std::string &path)
AFCFileTree get_file_tree(afc_client_t afcClient, const std::string &path,
bool checkDir)
{
AFCFileTree result;
@@ -47,9 +48,11 @@ AFCFileTree get_file_tree(afc_client_t afcClient, const std::string &path)
fullPath += "/";
fullPath += entryName;
bool isDir = false;
if (afc_get_file_info(afcClient, fullPath.c_str(), &info) ==
AFC_E_SUCCESS &&
info) {
if (!checkDir) {
isDir = false;
} else if (afc_get_file_info(afcClient, fullPath.c_str(), &info) ==
AFC_E_SUCCESS &&
info) {
if (entryName == "var") {
qDebug() << "File info for var:" << info[0] << info[1]
<< info[2] << info[3] << info[4] << info[5];
+1 -1
View File
@@ -316,7 +316,7 @@ struct AFCFileTree {
};
AFCFileTree get_file_tree(afc_client_t afcClient,
const std::string &path = "/");
const std::string &path = "/", bool checkDir = true);
bool detect_jailbroken(afc_client_t afc);
+3 -3
View File
@@ -151,13 +151,13 @@ ServiceManager::safeReadAfcFileToByteArray(iDescriptorDevice *device,
}
AFCFileTree ServiceManager::safeGetFileTree(iDescriptorDevice *device,
const std::string &path,
const std::string &path, bool checkDir,
std::optional<afc_client_t> altAfc)
{
return executeOperation<AFCFileTree>(
device,
[path](afc_client_t client) -> AFCFileTree {
return get_file_tree(client, path.c_str());
[path, checkDir](afc_client_t client) -> AFCFileTree {
return get_file_tree(client, path.c_str(), checkDir);
},
altAfc);
}
+1 -1
View File
@@ -214,7 +214,7 @@ public:
iDescriptorDevice *device, const char *path,
std::optional<afc_client_t> altAfc = std::nullopt);
static AFCFileTree
safeGetFileTree(iDescriptorDevice *device, const std::string &path = "/",
safeGetFileTree(iDescriptorDevice *device, const std::string &path = "/", bool checkDir = true,
std::optional<afc_client_t> altAfc = std::nullopt);
};