Re: [Vala] Downloading a file from the internet to some directory.
- From: Travis Watkins <amaranth ubuntu com>
- To: Julian Andres Klode <jak jak-linux org>
- Cc: vala-list <vala-list gnome org>
- Subject: Re: [Vala] Downloading a file from the internet to some directory.
- Date: Sun, 27 Sep 2009 06:32:10 -0500
On Sun, Sep 27, 2009 at 5:10 AM, Julian Andres Klode <jak jak-linux org> wrote:
Doesn't this require gvfsd-http? I am also looking at file downloads
for APT2 and everytime I use a http url, it starts gvfsd-http. And
installing all the gvfs backends is not really acceptable for APT2.
If you can stand a dependency on libsoup it doesn't get much more complicated:
using Soup;
static int main (string[] args) {
var session = new SessionSync ();
var message = new Message ("GET",
"http://download.gnome.org/sources/vala/0.7/vala-0.7.6.tar.bz2");
var status = session.send_message (message);
if (status == 200) {
FileUtils.set_contents ("vala-0.7.6.tar.bz2",
message.response_body.data,
(long)message.response_body.length);
return 0;
}
return -1;
}
Of course if you can't you'll have to wrap new API in posix.vapi and
it gets much harder. :)
--
Travis Watkins
http://www.realistanew.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]