Browse Source

some more error cases

David Rose 16 years ago
parent
commit
c015814321

+ 2 - 1
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";
 }

+ 6 - 0
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();
   }
 }

+ 5 - 0
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();
   }