commit 92aecfaddf67e8312e7d66efd607c062d7a0504a
Author: rani <clagv.randomgames@gmail.com>
Date: Thu May 25 16:32:51 2023 +0000
diff --git a/README.md b/README.md
index f3421cb..a178aef 100644
--- a/README.md
+++ b/README.md
@@ -986 +988 @@ The command prompt will show up upon pressing `:` and the prompt itself is prefi
The `d` command will always ask for confirmation to delete a file. If numerous files are marked, the prompt will show the number of marked files (as those will all be deleted). Whenever cscroll attempts to delete a non-empty directory, it will prompt for confirmation to do a recursive removal and will show the number of files that will be deleted inside of that directory. This secondary prompt will be shown whenever a non-empty directory is being deleted. No secondary prompt will be shown if the directory is empty.
+Recursive removal may not work properly on some operating systems, primarily on Android since Bionic libc seems to have a hardcode nested directory limit that it will operate on. Most directories will work fine with this but ones with thousands of nested directories may not work at all.
+
#### Renaming
The `r` command will show a prompt (similar to a command prompt but without a prefix) where the new file name is to be expected. A file may only be renamed within the same directory.
diff --git a/include/dir.h b/include/dir.h
index 5d7208a..f71bd56 100644
--- a/include/dir.h
+++ b/include/dir.h
@@ -156 +1514 @@
#define M_READ (1 << 2)
#define M_SUID (1 << 3)
+
+#ifdef __BIONIC__
+#define NFTW_NFDS 1
+#else
+#define NFTW_NFDS 0
+#endif
+
+
enum file_type_t {
FILE_REG,
FILE_DIR,
diff --git a/src/dir.c b/src/dir.c
index 4e8b096..8e72963 100644
--- a/src/dir.c
+++ b/src/dir.c
@@ -3127 +3128 @@ static int nftw_file_remove(const char * fp, const struct stat * sb, int tf, str
static size_t count_files(struct dir_entry_t * de) {
file_count = 0;
- nftw(de->name, nftw_file_count, 1024, FTW_MOUNT | FTW_PHYS);
+
+ nftw(de->name, nftw_file_count, NFTW_NFDS, FTW_MOUNT | FTW_PHYS);
return file_count;
}
@@ -3217 +3227 @@ static size_t count_files(struct dir_entry_t * de) {
static int remove_tree(struct dir_entry_t * de) {
remove_all_failed = 0;
- nftw(de->name, nftw_file_remove, 1024, FTW_MOUNT | FTW_PHYS | FTW_DEPTH);
+ nftw(de->name, nftw_file_remove, NFTW_NFDS, FTW_MOUNT | FTW_PHYS | FTW_DEPTH);
return remove_all_failed;
}