Re: [Vimprobable-users] Improve handling of file parameters
Vimprobable is a lean web browser optimised for full keyboard control
Brought to you by:
hanness
|
From: Daniel C. <dan...@gm...> - 2013-02-24 15:42:42
|
Hi!
Hannes Schüller <ha...@yl...> wrote:
> The second one, I don't really consider a problem, to be honest. You
> could easily just write
>
> vimprobable ./index.htm
This does not work for me. Because this leads to the URL 'file://./index.html'
which could not be found.
> Does anyone else have an opinion?
In my opinion the stat call isn't required. I think the '/' or './' should
be enough. But out of the none working vimprobable2 ./index.html we should use
the realpath on the file before creating the URL.
By the way we can reduce the code by replacing:
new = g_malloc(sizeof("file://") + len);
strcpy(new, "file://");
memcpy(&new[sizeof("file://") - 1], s, len + 1);
by:
uri = g_strdup_printf("file://%s", s);
I've made a little patch that applies to the master that demonstrates what I
want to have. But this didn't check if the realpath returned a value or not,
but as an example this should be enough.
Daniel
|