Fix OS layer returning with "/" at the end for directories

This commit is contained in:
Krzosa Karol
2026-01-05 15:10:29 +01:00
parent c90857eb46
commit 1a6159e0ec
2 changed files with 3 additions and 20 deletions

View File

@@ -18,7 +18,6 @@
Use session 4 Use session 4
- Add <<File>> <<WorkDir>> template strings to Open (Then remove SEtWorkdirhere) - Add <<File>> <<WorkDir>> template strings to Open (Then remove SEtWorkdirhere)
- :Set Filename to name current buffer ??? :O and others like that!! - :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 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 "@>" - 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 How to go about search/replace, opening code and other considerations
- Search and replace sign Find@>ReplaceWith - Search and replace sign Find@>ReplaceWith
- We can use sed + find to search and replace, the automatic reopen should do the job - 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 Use session 2
- Guide on the first page for new users with links to configs, tutorials - Guide on the first page for new users with links to configs, tutorials
@@ -57,8 +52,6 @@ New UI Session
- DBBuffer - DBBuffer
- Try to add Tracking Allocator and rewrite the app, free all memory at the end of the app and check all is well - 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 backlog
FEATURE Some decl/function indexing in fuzzy format FEATURE Some decl/function indexing in fuzzy format

View File

@@ -231,11 +231,9 @@ API void Advance(FileIter *it) {
it->is_directory = file->d_type == DT_DIR; it->is_directory = file->d_type == DT_DIR;
it->filename = Copy(it->allocator, file->d_name); 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] == '/' ? "" : "/"; 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); 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; it->is_valid = true;
return; return;
} }
@@ -540,16 +538,10 @@ API void Advance(FileIter *it) {
it->is_directory = data->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY; it->is_directory = data->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
it->filename = ToString(it->allocator, (char16_t *)data->cFileName, WideLength((char16_t *)data->cFileName)); 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] == '/' ? "" : "/"; 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->absolute_path = GetAbsolutePath(it->allocator, it->relative_path);
it->is_valid = true; 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; return;
} }
@@ -1103,11 +1095,9 @@ API void Advance(FileIter *it) {
it->is_directory = file->d_type == DT_DIR; it->is_directory = file->d_type == DT_DIR;
it->filename = Copy(it->allocator, file->d_name); 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] == '/' ? "" : "/"; 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); 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; it->is_valid = true;
return; return;
} }