summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorailurux <ailuruxx@gmail.com>2025-02-20 17:25:57 +1100
committerailurux <ailuruxx@gmail.com>2025-02-20 17:25:57 +1100
commitca74ace48c2df00e7d50c1e95da3542f60a81796 (patch)
tree7a3dd08f1e105f789d1635ee8dec2b844dd5c81f /src
parent49e92c295ea8f2e2cd9b0b23c2ca1479e3f2db2a (diff)
downloadtangara-fw-ca74ace48c2df00e7d50c1e95da3542f60a81796.tar.gz
Fix file iterator prev to work with hidden files present
Diffstat (limited to 'src')
-rw-r--r--src/tangara/lua/file_iterator.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/tangara/lua/file_iterator.cpp b/src/tangara/lua/file_iterator.cpp
index 71daf2d8..d2df8082 100644
--- a/src/tangara/lua/file_iterator.cpp
+++ b/src/tangara/lua/file_iterator.cpp
@@ -53,7 +53,7 @@ auto FileIterator::prev() -> void {
f_rewinddir(&dir_);
auto new_offset = offset_ - 1;
offset_ = -1;
- for (int i = 0; i <= new_offset; i++) {
+ while (offset_ < new_offset) {
iterate(show_hidden_);
}
}
@@ -72,9 +72,9 @@ auto FileIterator::iterate(bool show_hidden) -> bool {
return false;
} else {
// Update current value
- offset_++;
bool hidden = (info.fattrib & AM_HID) > 0 || info.fname[0] == '.';
if (!hidden || show_hidden) {
+ offset_++;
current_ = FileEntry{
.index = offset_,
.isHidden = hidden,