]>
cygwin.com Git - cygwin-apps/setup.git/blob - download.cc
2 * Copyright (c) 2000, Red Hat, Inc.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * A copy of the GNU General Public License can be found at
12 * Written by DJ Delorie <dj@cygnus.com>
16 /* The purpose of this file is to download all the files we need to
17 do the installation. */
19 static char *cvsid
= "\n%%% $Id$\n";
24 #include <sys/types.h>
37 #define pi (package[i].info[package[i].trust])
40 get_file_size (char *name
)
46 h
= FindFirstFileA (name
, &buf
);
49 if (buf
.nFileSizeHigh
== 0)
50 ret
= buf
.nFileSizeLow
;
57 download_one (char *name
, int expected_size
)
63 if ((size
= get_file_size (local
)) > 0)
64 if (size
== expected_size
)
69 if (get_url_to_file (concat (MIRROR_SITE
, "/", name
, 0),
70 concat (local
, ".tmp", 0),
73 note (IDS_DOWNLOAD_FAILED
, name
);
78 size
= get_file_size (concat (local
, ".tmp", 0));
79 if (size
== expected_size
)
81 log (0, "Downloaded %s", local
);
82 rename (concat (local
, ".tmp", 0), local
);
86 log (0, "Download %s wrong size (%d actual vs %d expected)",
87 local
, size
, expected_size
);
88 note (IDS_DOWNLOAD_SHORT
, local
, size
, expected_size
);
97 do_download (HINSTANCE h
)
102 for (i
=0; i
<npackages
; i
++)
103 if (package
[i
].action
== ACTION_NEW
|| package
[i
].action
== ACTION_UPGRADE
)
105 int e
= download_one (pi
.install
, pi
.install_size
);
106 if (package
[i
].srcaction
== SRCACTION_YES
&& pi
.source
)
107 e
+= download_one (pi
.source
, pi
.source_size
);
110 package
[i
].action
= ACTION_ERROR
;
113 dismiss_url_status_dialog ();
117 if (yesno (IDS_DOWNLOAD_INCOMPLETE
) == IDYES
)
119 next_dialog
= IDD_SITE
;
124 if (source
== IDC_SOURCE_DOWNLOAD
)
127 exit_msg
= IDS_DOWNLOAD_INCOMPLETE
;
129 exit_msg
= IDS_DOWNLOAD_COMPLETE
;
133 next_dialog
= IDD_S_INSTALL
;
This page took 0.397986 seconds and 5 git commands to generate.