mirror of
https://github.com/iDescriptor/iDescriptor.git
synced 2026-06-21 19:35:49 +08:00
add checkDir arg
This commit is contained in:
@@ -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
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user