-
-
Notifications
You must be signed in to change notification settings - Fork 81
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
Sample implementation of embedding theme files #43
Conversation
Thank you very much for your contribution! To be honest, I'd like to avoid doing this. As far as I can see, the only reason would be the packaging difficulties on macOS. I can't really believe that we can not solve this in another way. It should be possible to install a few files to a specified location and load them from there. |
It's not just packaging difficulties with macOS, but packaging difficulties on every platform. Currently, unless you are using debian or Arch, you need to download the repo and copy the files by hand. As I've discovered, every system is different, and the less we depend on the system, the better. Cargo doesn't let us copy files to a directory when doing If we embed the files, then it is possible for the average user to download the binary from the releases page and it'll work no matter where they put it. Users can also use The only time a user would need to add a file to the config directory would be if they wanted to customize one of the themes, and even then they also have the option of specifying the exact file via the command line or an environment variable. Embedding allows:
|
You have some excellent arguments, thank you. I will give this a review. |
Oh, that's pretty cool! |
@@ -47,9 +52,16 @@ fn load_filetypes_database(matches: &ArgMatches, user_config_path: &PathBuf) -> | |||
|
|||
let database_path = database_path_from_arg | |||
.or(database_path_env) | |||
.or_else(|| util::get_first_existing_path(&[&database_path_user, database_path_system])) | |||
.ok_or(VividError::CouldNotFindDatabase)?; |
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.
Can we remove VividError::CouldNotFindDatabase
in that case?
warning: variant is never constructed: `CouldNotFindDatabase`
--> src/error.rs:15:5
|
15 | CouldNotFindDatabase,
| ^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(dead_code)]` on by default
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 think so, although we will need to keep the CouldNotFindTheme error
The code changes look great - thank you very much! |
In this bit, it looks like we're setting the theme to molokai when |
Yes - sounds good. Thanks |
Turns out it's checking if no theme is specified. Should that raise an error? |
Well, for now, Ideally, we would cover all cases:
|
Since the database is now embedded in the executable, we don't need the CouldNotFindDatabase error. Added the NoThemeProvided error when the user doesn't add a theme to generate/preview
Thank you for the update! |
Building on #25, here's a sample of how we can embed the theme and filetypes files into the executable.