makepad_platform/os/
cx_native.rs

1use {
2    std::{
3        io::prelude::*,
4        fs::File,
5        rc::Rc,
6    },
7    crate::{
8        cx::{Cx},
9    }
10};
11
12#[derive(PartialEq, Eq, Clone, Copy, Debug)]
13pub enum EventFlow{
14    Poll,
15    Wait,
16    Exit
17}
18
19impl Cx {
20    
21    pub fn native_load_dependencies(&mut self){
22        for (path,dep) in &mut self.dependencies{
23            if let Ok(mut file_handle) = File::open(path) {
24                let mut buffer = Vec::<u8>::new();
25                if file_handle.read_to_end(&mut buffer).is_ok() {
26                    dep.data = Some(Ok(Rc::new(buffer)));
27                }
28                else{
29                    dep.data = Some(Err("read_to_end failed".to_string()));
30                }
31            }
32            else{
33                dep.data = Some(Err("File open failed".to_string()));
34            }
35        }
36    }
37}