some more error cases

This commit is contained in:
David Rose 2009-10-23 00:25:50 +00:00
parent 4bc0c2b591
commit c015814321
3 changed files with 13 additions and 1 deletions

View File

@ -183,5 +183,6 @@ download_progress() {
void P3DDownload::
download_finished(bool success) {
nout << "Downloaded " << get_url() << ": "
<< int(get_download_progress() * 1000.0) / 10.0 << "\n";
<< int(get_download_progress() * 1000.0) / 10.0
<< ", success = " << success << "\n";
}

View File

@ -975,6 +975,9 @@ start_download(P3DDownload *download, bool add_request) {
bool inserted = _downloads.insert(Downloads::value_type(download_id, download)).second;
assert(inserted);
// add_request will be false only for the initial p3d stream, which
// the plugin already knows about. For all other download streams,
// add_request is true in order to ask the plugin for the stream.
if (add_request) {
P3D_request *request = new P3D_request;
request->_request_type = P3D_RT_get_url;
@ -2560,5 +2563,8 @@ download_finished(bool success) {
if (success) {
// We've successfully downloaded the instance data.
_inst->set_p3d_filename(get_filename());
} else {
// Oops, no joy on the instance data.
_inst->set_failed();
}
}

View File

@ -944,6 +944,11 @@ create_instance(const string &p3d, P3D_window_type window_type,
string os_p3d_filename = p3d;
bool is_local = !is_url(p3d);
if (is_local) {
if (!p3d_filename.exists()) {
cerr << "No such file: " << p3d_filename << "\n";
exit(1);
}
p3d_filename.make_absolute();
os_p3d_filename = p3d_filename.to_os_specific();
}