Conversation
Prioritize XDG folder
Discards previous history
| end | ||
| end | ||
|
|
||
| local function getHistoryFile(debugger, mode) |
There was a problem hiding this comment.
You could cache the response so we don't stat two files each time we add something to the history
There was a problem hiding this comment.
I don't quite understand what you mean by that. Could you elaborate?
There was a problem hiding this comment.
You only need the information about which file is the right one once. So keep that information somewhere (cache it), and return that instead of checking files each time getHistoryFile is called.
There was a problem hiding this comment.
Where would you implement the cache? Function wise? Session wise on boot?
Implementing a cache is a delicate task that should be handled with care, with some edge cases.
I don't think checking for a file existence is a task worth caching, honestly.
In addition, is this duality between xdg files and home files a feature that you want to keep in croissant? I mean, is there a reason to keep it long term? I personally would migrate towards xdg completely, and not check for files in $HOME.
Maybe if you want to keep it customizable, a envvar could be read. I personally never use those per app config path envvars, I have $XDG_{FOLDER}_HOME if I ever want to move all my configurations
On the other hand, in my code for getHistoryFile I only stat one file (old $HOME/.croissanthistory is ignored.
Regarding the config file, the old config is only checked up if the xdg one does not exist.
|
Thanks for this, see the only comment I had |
Solves #10