From 047b370b9d5ac4f0087d1e1cb13f519de0984311 Mon Sep 17 00:00:00 2001 From: David Rose Date: Thu, 2 Jul 2009 00:30:49 +0000 Subject: [PATCH] some safari hacks --- direct/src/plugin_npapi/ppInstance.cxx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/direct/src/plugin_npapi/ppInstance.cxx b/direct/src/plugin_npapi/ppInstance.cxx index 807438c2c2..c2ff2438dc 100644 --- a/direct/src/plugin_npapi/ppInstance.cxx +++ b/direct/src/plugin_npapi/ppInstance.cxx @@ -298,6 +298,19 @@ stream_as_file(NPStream *stream, const char *fname) { logfile << "converted filename to " << filename << "\n"; } + // Here's another temporary hack. In addition to the weird filename + // format, the file that Safari tells us about appears to be a + // temporary file that Safari's about to delete. In order to + // protect ourselves from this, we need to either open the file + // immediately, or copy it somewhere else. The instance_data + // filename can't be copied, so in the short term, we implement this + // quick hack: if we're just downloading from "file://", then remap + // the filename to point to the source file. + if (strncmp(stream->url, "file://", 7) == 0) { + filename = stream->url + 7; + logfile << "converted filename again to " << filename << "\n"; + } + #endif // __APPLE__ PPDownloadRequest *req = (PPDownloadRequest *)(stream->notifyData); @@ -636,10 +649,13 @@ handle_evaluate(const string &expression, int unique_id) { } else { logfile << "Couldn't evaluate\n"; + P3D_instance_feed_value(_p3d_inst, unique_id, NULL); } } else { - logfile << "Couldn't get object for NPNVWindowNPObject\n"; + logfile << "Couldn't get object for NPNVWindowNPObject: " << window + << "\n"; + P3D_instance_feed_value(_p3d_inst, unique_id, NULL); } }