-
Notifications
You must be signed in to change notification settings - Fork 157
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
feat: add case_sensitive_ext
option for mimetype, theme and icons
#497
Conversation
src/main.rs
Outdated
@@ -68,6 +68,8 @@ lazy_static! { | |||
|
|||
config_dirs | |||
}; | |||
|
|||
static ref CONFIG_T: AppConfig = AppConfig::get_config(); |
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.
Having it as a static reference here seems to be the only solution... That's not a problem right?
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.
Instead of making the config static, I think the less intrusive approach is to just check the config to see if option is enabled and pass the already lowercase version into app_list_for_ext
.
ie. inside open_file.rs
, change _get_options
to take &AppConfig
as a parameter
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.
Well, that works but just for the mimetype part, for theme and icons there is something more to do, but I'll try
Here is the new implementation, which involves a lot of extra clones, not sure if that's better than having a static config. Speaking of clones, I was wondering if it would be a good idea to do a major refactor using only one static config (like |
Yeah, the issue is with static, its read-only I believe. |
Currently any file with an uppercase or partially uppercase extension is not recognized by either
mimetype.toml
,theme.toml
andicons.toml
. With this addition, when the flag is set tofalse
, any uppercase/lowercase variant of an extension will be correctly detected. I set it tofalse
by default because it just makes sense to me, but we can set it totrue
if we want to keep the current behavior by default.