diff --git a/src/core/services/get_file_tree.cpp b/src/core/services/get_file_tree.cpp index 9796205..2c7bba5 100644 --- a/src/core/services/get_file_tree.cpp +++ b/src/core/services/get_file_tree.cpp @@ -24,7 +24,8 @@ #include #include -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]; diff --git a/src/iDescriptor.h b/src/iDescriptor.h index d00dc82..3ed44f0 100644 --- a/src/iDescriptor.h +++ b/src/iDescriptor.h @@ -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); diff --git a/src/servicemanager.cpp b/src/servicemanager.cpp index 1fe4772..cbe9411 100644 --- a/src/servicemanager.cpp +++ b/src/servicemanager.cpp @@ -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 altAfc) { return executeOperation( 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); } \ No newline at end of file diff --git a/src/servicemanager.h b/src/servicemanager.h index 446489a..ec234ce 100644 --- a/src/servicemanager.h +++ b/src/servicemanager.h @@ -214,7 +214,7 @@ public: iDescriptorDevice *device, const char *path, std::optional altAfc = std::nullopt); static AFCFileTree - safeGetFileTree(iDescriptorDevice *device, const std::string &path = "/", + safeGetFileTree(iDescriptorDevice *device, const std::string &path = "/", bool checkDir = true, std::optional altAfc = std::nullopt); };