fix: files not recognized if their parent dir starts with a special char #132
fix: files not recognized if their parent dir starts with a special char #132suitablebeard wants to merge 1 commit into
Conversation
Let's say we have a file with this path: `/notes/+/file.md`.
Since the functions for opening files try to make the filepaths relative
to the cwd, there are cases where a filepath might start with a special
character. After such character is escaped, the execute command runs
something similar to this: `exec "edit \+/file.md"`.
The problem is that the exec command seems to read the backslash as a
directory indicator and thus creates a file not relative to the cwd but
rather in the root directory. In Windows, this becomes the path for the
file `C:\+\file.md` (which can be seen with `echo
fnamemodify(expand('%'), ':p')` after opening the file with the exec)
Using the full path instead solves the issue.
|
Hi, thanks for looking into this and opening a PR :-) I think the issue here is with Removing the If you remove the The answer here might be to extract a function to get the file path to open, and make it aware of leading |
|
Hi, Found a little time to do some testing and as expected this only seems to affect Windows, the problem is the I'll take another look when I have some time tomorrow and try to get a fix based on your change merged. Thanks |
|
This should be fixed now in |
I noticed that whenever I tried to open a file with Fuzzbox inside the directory '/Docs/+ new notes/' it kept opening brand new files.
The bellow explains what exactly the issue is. Here, I use the plus symbol as an example but this also happened with others.
(extracted from my commit message)
To better understand this, let's say we have a file with this path:
/notes/+/file.md.Since the functions for opening files try to make the filepaths relative to the cwd, there are cases where a filepath might start with a special character. After such character is escaped, the execute command runs something similar to this:
The problem is that the exec command seems to read the backslash as a directory indicator and thus creates a file not relative to the cwd but rather in the root directory. In Windows, this becomes the path for the file
which can be seen with
echo fnamemodify(expand('%'), ':p')Now I see two solutions:
I chose solution 1.