-
-
Notifications
You must be signed in to change notification settings - Fork 994
Desktop: Make embedded resources optional #3094
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
Conversation
|
I'm unfamiliar with what kinds of resources these are, could you give some examples please? |
The frontend files, |
desktop/src/cef.rs
Outdated
|
|
||
| #[derive(Clone)] | ||
| pub(crate) struct Resource { | ||
| pub(crate) data: Vec<u8>, |
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.
Would it make sense to make this a Cow<'static, [u8]> ?
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.
The results of a fs::read cannot be 'static, see usage of this struct.
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.
if let Ok(data) = std::fs::read(file_path) {
return Some(Resource { data, mimetype });
}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.
Yes, but include dir should give you static references, 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.
Yes, but this pr also adds the ability to create resources from disk. Could be behind feature flag for now, but would like to have override functionality in the future.
cfg(embedded_resources)if resource dir existsGRAPHITE_RESOURCESwhen build without the embedded_resources feature