Claude: reduced the file and dir count (still bad code) but works

This commit is contained in:
Niklas Jensen
2026-01-05 21:21:52 +01:00
committed by Rune Harlyk
parent 957b60b132
commit 26c187a480
4 changed files with 43 additions and 12 deletions
+3 -3
View File
@@ -108,14 +108,14 @@ void FileSystemHandler::listDirectory(const std::string& path, socket_message_FS
int fileCount = 0;
int dirCount = 0;
while (file && fileCount < 50 && dirCount < 50) { // Limit to prevent overflow
while (file && fileCount < 20 && dirCount < 20) { // Limit to match protobuf max_count
if (file.isDirectory()) {
if (dirCount < 50) {
if (dirCount < 20) {
strncpy(response.directories[dirCount].name, file.name(), sizeof(response.directories[dirCount].name) - 1);
dirCount++;
}
} else {
if (fileCount < 50) {
if (fileCount < 20) {
strncpy(response.files[fileCount].name, file.name(), sizeof(response.files[fileCount].name) - 1);
response.files[fileCount].size = file.size();
fileCount++;