From 1a6159e0ec9e640dc2acf063840c1a744975f090 Mon Sep 17 00:00:00 2001 From: Krzosa Karol Date: Mon, 5 Jan 2026 15:10:29 +0100 Subject: [PATCH] Fix OS layer returning with "/" at the end for directories --- src/backup/todo.txt | 7 ------- src/basic/basic_os.cpp | 16 +++------------- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/src/backup/todo.txt b/src/backup/todo.txt index 9bfc31b..3016b76 100644 --- a/src/backup/todo.txt +++ b/src/backup/todo.txt @@ -18,7 +18,6 @@ Use session 4 - Add <> <> template strings to Open (Then remove SEtWorkdirhere) - :Set Filename to name current buffer ??? :O and others like that!! -- :Close Fuzzy search exact match doesn't match with Close - Make a fuzzy command !> grep and fuzzy over it??? (doesn't seem very useful for grep) - Make the equivalent of SearchProject but for cmds like !@git grep -n "@>" @@ -31,10 +30,6 @@ Use session 3: How to go about search/replace, opening code and other considerations - Search and replace sign Find@>ReplaceWith - We can use sed + find to search and replace, the automatic reopen should do the job -- Maybe also we can List all files recursively instead of opening them, how fast is that??? -- For fuzzy find number of files is the problem - most likely just getting them in one place is the biggest problem that can be optimized -- Opening code is problematic for large / weird files, they stall for a while, getting them buffered up is hard. And they stall the execution when they go overboard. Maybe just skipping on filesisze on something would be enough, or making a very large skip list. Another solution would be lazy loaded buffers + determining what kind of file we are dealing with on open before loading -- Search everything, like fuzzy panel, on every key stroke we grep immediately and get new results, cancel old, reset Use session 2 - Guide on the first page for new users with links to configs, tutorials @@ -57,8 +52,6 @@ New UI Session - DBBuffer - Try to add Tracking Allocator and rewrite the app, free all memory at the end of the app and check all is well -- Maybe fix OS layer returning with "/" at the end for directories - - Fix open code pattern backlog FEATURE Some decl/function indexing in fuzzy format diff --git a/src/basic/basic_os.cpp b/src/basic/basic_os.cpp index e5b8bb1..f10e428 100644 --- a/src/basic/basic_os.cpp +++ b/src/basic/basic_os.cpp @@ -231,11 +231,9 @@ API void Advance(FileIter *it) { it->is_directory = file->d_type == DT_DIR; it->filename = Copy(it->allocator, file->d_name); - const char *dir_char_ending = it->is_directory ? "/" : ""; const char *separator = it->path.data[it->path.len - 1] == '/' ? "" : "/"; - it->relative_path = Format(it->allocator, "%S%s%s%s", it->path, separator, file->d_name, dir_char_ending); + it->relative_path = Format(it->allocator, "%S%s%s", it->path, separator, file->d_name); it->absolute_path = GetAbsolutePath(it->allocator, it->relative_path); - if (it->is_directory) it->absolute_path = Format(it->allocator, "%S/", it->absolute_path); it->is_valid = true; return; } @@ -540,16 +538,10 @@ API void Advance(FileIter *it) { it->is_directory = data->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY; it->filename = ToString(it->allocator, (char16_t *)data->cFileName, WideLength((char16_t *)data->cFileName)); - const char *is_dir = it->is_directory ? "/" : ""; const char *separator = it->path.data[it->path.len - 1] == '/' ? "" : "/"; - it->relative_path = Format(it->allocator, "%S%s%S%s", it->path, separator, it->filename, is_dir); + it->relative_path = Format(it->allocator, "%S%s%S", it->path, separator, it->filename); it->absolute_path = GetAbsolutePath(it->allocator, it->relative_path); it->is_valid = true; - - if (it->is_directory) { - Assert(it->relative_path.data[it->relative_path.len - 1] == '/'); - Assert(it->absolute_path.data[it->absolute_path.len - 1] == '/'); - } return; } @@ -1103,11 +1095,9 @@ API void Advance(FileIter *it) { it->is_directory = file->d_type == DT_DIR; it->filename = Copy(it->allocator, file->d_name); - const char *dir_char_ending = it->is_directory ? "/" : ""; const char *separator = it->path.data[it->path.len - 1] == '/' ? "" : "/"; - it->relative_path = Format(it->allocator, "%S%s%s%s", it->path, separator, file->d_name, dir_char_ending); + it->relative_path = Format(it->allocator, "%S%s%s", it->path, separator, file->d_name); it->absolute_path = GetAbsolutePath(it->allocator, it->relative_path); - if (it->is_directory) it->absolute_path = Format(it->allocator, "%S/", it->absolute_path); it->is_valid = true; return; }