paulrouget / servofocus

Experimenting with a Xamarin.Forms + Servo
5 stars 2 forks source link

Pass the absolute path of the resources directory to libservo #2

Open paulrouget opened 6 years ago

paulrouget commented 6 years ago

I need the absolute path of the resources directory, where we put the Servo resources files.

No need to pass it to init just yet, I just need to know how to get it, as a char *.

/cc @mfkl

paulrouget commented 6 years ago

fwiw, resources can be copied from here: https://github.com/servo/servo/tree/master/resources

paulrouget commented 6 years ago

That's how init is called now:

pub extern "C" fn init(
    wakeup: extern fn(),
    resources_path: *const c_char
    width: u32
    height: u32
}
mfkl commented 6 years ago

Yeah. It's already in the repo https://github.com/paulrouget/servofocus/tree/master/xamarin/resources Found a way to include them in the shared project (referenced by all apps) as Embed Resources. Now looking into how to find the correct path on each platform.

paulrouget commented 6 years ago

I don't know if that helps, but usually we use externalDataPath / internalDataPath to access these resources on Android.

paulrouget commented 6 years ago

So yeah, it's not possible to access resources with an absolute path. So a workaround is to copy the resources to the sdcard at startup. That sucks.

For now, we can just copy the resources folder manually, but a long term solution is for Servo to not use an absolute path but a stream.

paulrouget commented 6 years ago

I posted on dev-servo about this issue.

mfkl commented 6 years ago

Yeah I got the workaround implementation somewhere in my stash. Still want it?

paulrouget commented 6 years ago

Nope. Thanks. Let's do that manually for now.