Desktop: Make embedded resources optional#3094
Conversation
|
I'm unfamiliar with what kinds of resources these are, could you give some examples please? |
The frontend files, |
|
|
||
| #[derive(Clone)] | ||
| pub(crate) struct Resource { | ||
| pub(crate) data: Vec<u8>, |
There was a problem hiding this comment.
Would it make sense to make this a Cow<'static, [u8]> ?
There was a problem hiding this comment.
The results of a fs::read cannot be 'static, see usage of this struct.
There was a problem hiding this comment.
if let Ok(data) = std::fs::read(file_path) {
return Some(Resource { data, mimetype });
}There was a problem hiding this comment.
Yes, but include dir should give you static references, right?
There was a problem hiding this comment.
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