From c01581432152078a97e09588a429985224b16ae1 Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 23 Oct 2009 00:25:50 +0000 Subject: [PATCH] some more error cases --- direct/src/plugin/p3dDownload.cxx | 3 ++- direct/src/plugin/p3dInstance.cxx | 6 ++++++ direct/src/plugin_standalone/panda3d.cxx | 5 +++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/direct/src/plugin/p3dDownload.cxx b/direct/src/plugin/p3dDownload.cxx index ae5862c058..394a4ad74f 100755 --- a/direct/src/plugin/p3dDownload.cxx +++ b/direct/src/plugin/p3dDownload.cxx @@ -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"; } diff --git a/direct/src/plugin/p3dInstance.cxx b/direct/src/plugin/p3dInstance.cxx index 8376bab1f4..ff9f607629 100644 --- a/direct/src/plugin/p3dInstance.cxx +++ b/direct/src/plugin/p3dInstance.cxx @@ -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(); } } diff --git a/direct/src/plugin_standalone/panda3d.cxx b/direct/src/plugin_standalone/panda3d.cxx index 69d311bb85..e705a1997b 100644 --- a/direct/src/plugin_standalone/panda3d.cxx +++ b/direct/src/plugin_standalone/panda3d.cxx @@ -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(); }