-
-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Xdg compliance #11
base: master
Are you sure you want to change the base?
Xdg compliance #11
Conversation
Prioritize XDG folder
Discards previous history
@@ -263,10 +263,25 @@ local function runFile(script, arguments) | |||
end | |||
end | |||
|
|||
local function getHistoryFile(debugger, mode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't quite understand what you mean by that. Could you elaborate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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